mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
client: Added a missing NULL pointer check.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
bec13a6ac0
commit
4c300313c3
@@ -105,11 +105,16 @@ static int callback_receive_banner(const void *data, size_t len, void *user) {
|
|||||||
ssh_pcap_context_write(session->pcap_ctx,SSH_PCAP_DIR_IN,buffer,i+1,i+1);
|
ssh_pcap_context_write(session->pcap_ctx,SSH_PCAP_DIR_IN,buffer,i+1,i+1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if(buffer[i]=='\r')
|
if(buffer[i]=='\r') {
|
||||||
buffer[i]='\0';
|
buffer[i]='\0';
|
||||||
|
}
|
||||||
if (buffer[i]=='\n') {
|
if (buffer[i]=='\n') {
|
||||||
buffer[i] = '\0';
|
buffer[i] = '\0';
|
||||||
str = strdup(buffer);
|
str = strdup(buffer);
|
||||||
|
if (str == NULL) {
|
||||||
|
leave_function();
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
/* number of bytes read */
|
/* number of bytes read */
|
||||||
ret = i + 1;
|
ret = i + 1;
|
||||||
session->serverbanner = str;
|
session->serverbanner = str;
|
||||||
|
|||||||
Reference in New Issue
Block a user