diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2017-03-06 02:03:20 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2017-03-16 13:41:17 +0000 |
commit | 35b2ea77a74348b575d680061f35ec7992b26ec8 (patch) | |
tree | ab6276a5de798a7603e0d7712322b0811fc4f6ab | |
parent | a0f9daa9c3cc2b37b9707b228263eb717d201371 (diff) |
upstream commit
Check l->hosts before dereferencing; fixes potential null
pointer deref. ok djm@
Upstream-ID: 81c0327c6ec361da794b5c680601195cc23d1301
Origin: https://anongit.mindrot.org/openssh.git/commit/?id=18501151cf272a15b5f2c5e777f2e0933633c513
Last-Update: 2017-03-16
Patch-Name: ssh-keygen-null-deref.patch
-rw-r--r-- | ssh-keygen.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c index 0833ee61d..a7c1e80b9 100644 --- a/ssh-keygen.c +++ b/ssh-keygen.c | |||
@@ -1082,7 +1082,7 @@ known_hosts_hash(struct hostkey_foreach_line *l, void *_ctx) | |||
1082 | struct known_hosts_ctx *ctx = (struct known_hosts_ctx *)_ctx; | 1082 | struct known_hosts_ctx *ctx = (struct known_hosts_ctx *)_ctx; |
1083 | char *hashed, *cp, *hosts, *ohosts; | 1083 | char *hashed, *cp, *hosts, *ohosts; |
1084 | int has_wild = l->hosts && strcspn(l->hosts, "*?!") != strlen(l->hosts); | 1084 | int has_wild = l->hosts && strcspn(l->hosts, "*?!") != strlen(l->hosts); |
1085 | int was_hashed = l->hosts[0] == HASH_DELIM; | 1085 | int was_hashed = l->hosts && l->hosts[0] == HASH_DELIM; |
1086 | 1086 | ||
1087 | switch (l->status) { | 1087 | switch (l->status) { |
1088 | case HKF_STATUS_OK: | 1088 | case HKF_STATUS_OK: |