aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-06-05 10:35:42 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-06-05 10:35:42 +0200
commit669678119c6cc565ff98786f3f0f92bad38e4c8d (patch)
tree72cf7574959758be1245a1c31af54822b498ee75
parent34e7a3cf8c630f78548b2230c4dca8f04b6b5c50 (diff)
downloadlibssh-669678119c6cc565ff98786f3f0f92bad38e4c8d.tar.gz
libssh-669678119c6cc565ff98786f3f0f92bad38e4c8d.tar.xz
libssh-669678119c6cc565ff98786f3f0f92bad38e4c8d.zip
knownhosts: Fix possible null pointer dereference
CID 1391447 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/knownhosts.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/knownhosts.c b/src/knownhosts.c
index 7563d273..f9aa1588 100644
--- a/src/knownhosts.c
+++ b/src/knownhosts.c
@@ -403,10 +403,12 @@ int ssh_known_hosts_parse_line(const char *hostname,
p = strtok(NULL, " ");
if (p != NULL) {
p = strstr(line, p);
- e->comment = strdup(p);
- if (e->comment == NULL) {
- rc = SSH_ERROR;
- goto out;
+ if (p != NULL) {
+ e->comment = strdup(p);
+ if (e->comment == NULL) {
+ rc = SSH_ERROR;
+ goto out;
+ }
}
}