From 2ef23bb8128503feefa36ca90a85c74e4dd62a9b Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 22 Nov 2014 10:12:47 +0000 Subject: [PATCH] Fix typo in validate_manual_hostkey(). 'p += strcspn' returns p always non-NULL and sometimes pointing at \0, as opposed to 'p = strchr' which returns p sometimes non-NULL and never pointing at \0. Test the pointer after the call accordingly. Thanks, Coverity. --- misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc.c b/misc.c index 24e42eba..63de9d11 100644 --- a/misc.c +++ b/misc.c @@ -943,7 +943,7 @@ int validate_manual_hostkey(char *key) while ((p += strspn(p, " \t"))[0]) { q = p; p += strcspn(p, " \t"); - if (p) *p++ = '\0'; + if (*p) *p++ = '\0'; /* * Now q is our word. -- 2.45.2