Compare commits

..

8 Commits

Author SHA1 Message Date
Andreas Schneider
d672dde342 Increase version number and update Changelog. 2009-08-18 10:06:02 +02:00
Vic Lee
86f983962c Fix double free pointer crash in dsa_public_to_string
Signed-off-by: Andreas Schneider <mail@cynapses.org>
2009-08-16 14:41:41 +02:00
Aris Adamantiadis
b0d6307d41 Fix channel_get_exit_status bug reported by VicLee
It would return -1 if the channel received the exit status
and the close message at same time.
2009-08-16 14:41:22 +02:00
Aris Adamantiadis
10920fc678 fix ssh_finalize which didn't clear the flag 2009-08-13 23:30:02 +02:00
Aris Adamantiadis
c87b247e01 Fix memory leak introduced by previous bugfix 2009-08-12 22:12:18 +02:00
Aris Adamantiadis
9abdc5ae2a Fixed channel_poll broken when delayed EOF recvd
Previous code returned SSH_EOF even if data was left in buffer
2009-08-10 23:37:53 +02:00
Aris Adamantiadis
e8e874909f Fixed stupid "can't parse known host key" bug
due to a dangling \n in the base64 ...
2009-08-10 22:53:27 +02:00
milo
74eff86a6b Fix possible memory corruption (#14)
Signed-off-by: Andreas Schneider <mail@cynapses.org>
2009-08-07 11:38:18 +02:00
13 changed files with 45 additions and 29 deletions

View File

@@ -6,13 +6,13 @@ cmake_minimum_required(VERSION 2.6.0)
# global needed variables
set(APPLICATION_NAME ${PROJECT_NAME})
set(APPLICATION_VERSION "0.3.2")
set(APPLICATION_VERSION "0.3.3")
set(APPLICATION_VERSION_MAJOR "0")
set(APPLICATION_VERSION_MINOR "3")
set(APPLICATION_VERSION_PATCH "2")
set(APPLICATION_VERSION_PATCH "3")
set(LIBRARY_VERSION "3.2.0")
set(LIBRARY_VERSION "3.3.0")
set(LIBRARY_SOVERSION "3")
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked

View File

@@ -15,7 +15,7 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
### versions
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "3")
set(CPACK_PACKAGE_VERSION_PATCH "2")
set(CPACK_PACKAGE_VERSION_PATCH "3")
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")

View File

@@ -1,6 +1,15 @@
ChangeLog
==========
version 0.3.3 (released 2009-08-18)
* Fixed double free pointer crash in dsa_public_to_string.
* Fixed channel_get_exit_status bug.
* Fixed ssh_finalize which didn't clear the flag.
* Fixed memory leak introduced by previous bugfix.
* Fixed channel_poll broken when delayed EOF recvd.
* Fixed stupid "can't parse known host key" bug.
* Fixed possible memory corruption (ticket #14).
version 0.3.2 (released 2009-08-05)
* Added ssh_init() function.
* Added sftp_readlink() function.

View File

@@ -51,7 +51,7 @@ typedef unsigned long long uint64_t;
/* libssh version */
#define LIBSSH_VERSION_MAJOR 0
#define LIBSSH_VERSION_MINOR 3
#define LIBSSH_VERSION_MICRO 1
#define LIBSSH_VERSION_MICRO 3
#define LIBSSH_VERSION_INT SSH_VERSION_INT(LIBSSH_VERSION_MAJOR, \
LIBSSH_VERSION_MINOR, \

View File

@@ -327,7 +327,7 @@ int agent_get_ident_count(struct ssh_session *session) {
}
if (session->agent->ident) {
buffer_free(session->agent->ident);
buffer_reinit(session->agent->ident);
}
session->agent->ident = reply;

View File

@@ -268,7 +268,7 @@ int ssh_userauth_none(SSH_SESSION *session, const char *username) {
leave_function();
return rc;
error:
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
string_free(service);
string_free(method);
string_free(user);
@@ -382,7 +382,7 @@ int ssh_userauth_offer_pubkey(SSH_SESSION *session, const char *username,
leave_function();
return rc;
error:
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
string_free(user);
string_free(method);
string_free(service);
@@ -503,7 +503,7 @@ int ssh_userauth_pubkey(SSH_SESSION *session, const char *username,
leave_function();
return rc;
error:
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
string_free(user);
string_free(service);
string_free(method);
@@ -627,7 +627,7 @@ int ssh_userauth_agent_pubkey(SSH_SESSION *session, const char *username,
return rc;
error:
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
string_free(sign);
string_free(user);
string_free(service);
@@ -739,7 +739,7 @@ int ssh_userauth_password(SSH_SESSION *session, const char *username,
leave_function();
return rc;
error:
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
string_free(user);
string_free(service);
string_free(method);
@@ -1123,7 +1123,7 @@ static int kbdauth_init(SSH_SESSION *session, const char *user,
leave_function();
return rc;
error:
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
string_free(usr);
string_free(service);
string_free(method);
@@ -1290,7 +1290,7 @@ static int kbdauth_send(SSH_SESSION *session) {
leave_function();
return rc;
error:
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
string_burn(answer);
string_free(answer);

View File

@@ -280,7 +280,7 @@ static int grow_window(SSH_SESSION *session, CHANNEL *channel, int minimumsize)
leave_function();
return 0;
error:
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
leave_function();
return -1;
@@ -791,7 +791,7 @@ int channel_send_eof(CHANNEL *channel){
leave_function();
return rc;
error:
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
leave_function();
return rc;
@@ -844,7 +844,7 @@ int channel_close(CHANNEL *channel){
leave_function();
return rc;
error:
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
leave_function();
return rc;
@@ -938,7 +938,7 @@ int channel_write(CHANNEL *channel, const void *data, u32 len) {
leave_function();
return origlen;
error:
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
leave_function();
return SSH_ERROR;
@@ -1060,7 +1060,7 @@ static int channel_request(CHANNEL *channel, const char *request,
leave_function();
return rc;
error:
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
string_free(req);
leave_function();
@@ -1618,6 +1618,9 @@ int channel_poll(CHANNEL *channel, int is_stderr){
}
}
if (buffer_get_rest_len(stdbuf) > 0)
return buffer_get_rest_len(stdbuf);
if (channel->remote_eof) {
leave_function();
return SSH_EOF;
@@ -1658,7 +1661,9 @@ int channel_get_exit_status(CHANNEL *channel) {
return -1;
}
if (channel->open == 0) {
return -1;
/* When a channel is closed, no exit status message can
* come anymore */
break;
}
}

View File

@@ -149,6 +149,7 @@ void ssh_crypto_finalize(void) {
g = NULL;
bignum_free(p);
p = NULL;
ssh_crypto_initialized=0;
}
}
@@ -626,20 +627,20 @@ int hashbufout_add_cookie(SSH_SESSION *session) {
}
if (buffer_add_u8(session->out_hashbuf, 20) < 0) {
buffer_free(session->out_hashbuf);
buffer_reinit(session->out_hashbuf);
return -1;
}
if (session->server) {
if (buffer_add_data(session->out_hashbuf,
session->server_kex.cookie, 16) < 0) {
buffer_free(session->out_hashbuf);
buffer_reinit(session->out_hashbuf);
return -1;
}
} else {
if (buffer_add_data(session->out_hashbuf,
session->client_kex.cookie, 16) < 0) {
buffer_free(session->out_hashbuf);
buffer_reinit(session->out_hashbuf);
return -1;
}
}
@@ -654,11 +655,11 @@ int hashbufin_add_cookie(SSH_SESSION *session, unsigned char *cookie) {
}
if (buffer_add_u8(session->in_hashbuf, 20) < 0) {
buffer_free(session->in_hashbuf);
buffer_reinit(session->in_hashbuf);
return -1;
}
if (buffer_add_data(session->in_hashbuf,cookie, 16) < 0) {
buffer_free(session->in_hashbuf);
buffer_reinit(session->in_hashbuf);
return -1;
}

View File

@@ -421,8 +421,8 @@ int ssh_send_kex(SSH_SESSION *session, int server_kex) {
leave_function();
return 0;
error:
buffer_free(session->out_buffer);
buffer_free(session->out_hashbuf);
buffer_reinit(session->out_buffer);
buffer_reinit(session->out_hashbuf);
string_free(str);
leave_function();

View File

@@ -1074,6 +1074,7 @@ static char **ssh_get_knownhost_line(SSH_SESSION *session, FILE **file,
while (fgets(buffer, sizeof(buffer), *file)) {
ptr = strchr(buffer, '\n');
if (ptr) {
*ptr = '\0';
}
ptr = strchr(buffer,'\r');

View File

@@ -540,7 +540,6 @@ static int dsa_public_to_string(DSA *key, BUFFER *buffer) {
goto error;
}
string_fill(n, (char *) tmp, size);
gcry_sexp_release(sexp);
#elif defined HAVE_LIBCRYPTO
p = make_bignum_string(key->p);

View File

@@ -424,7 +424,7 @@ static int dh_handshake_server(SSH_SESSION *session) {
buffer_add_ssh_string(session->out_buffer, f) < 0 ||
buffer_add_ssh_string(session->out_buffer, sign) < 0) {
ssh_set_error(session, SSH_FATAL, "Not enough space");
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
string_free(f);
string_free(sign);
return -1;
@@ -437,7 +437,7 @@ static int dh_handshake_server(SSH_SESSION *session) {
}
if (buffer_add_u8(session->out_buffer, SSH2_MSG_NEWKEYS) < 0) {
buffer_free(session->out_buffer);
buffer_reinit(session->out_buffer);
return -1;
}

View File

@@ -99,6 +99,7 @@ void ssh_cleanup(SSH_SESSION *session) {
SAFE_FREE(session->banner);
buffer_free(session->in_buffer);
buffer_free(session->out_buffer);
session->in_buffer=session->out_buffer=NULL;
crypto_free(session->current_crypto);
crypto_free(session->next_crypto);
ssh_socket_free(session->socket);