From ee5d6441d4964fcb07d00a8c4b4f604f74efe386 Mon Sep 17 00:00:00 2001 From: zhuk Date: Tue, 19 Dec 2017 20:44:53 +0000 Subject: [PATCH] More NUL (not NULL) checks. With support from guenther@ and millert@; final okay espie@ --- usr.bin/make/cond.c | 6 +++--- usr.bin/make/parse.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c index 41ff09a9857..d80ad0efe02 100644 --- a/usr.bin/make/cond.c +++ b/usr.bin/make/cond.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cond.c,v 1.52 2017/06/21 00:11:36 espie Exp $ */ +/* $OpenBSD: cond.c,v 1.53 2017/12/19 20:44:53 zhuk Exp $ */ /* $NetBSD: cond.c,v 1.7 1996/11/06 17:59:02 christos Exp $ */ /* @@ -398,7 +398,7 @@ CondHandleNumber(bool doEval) char *lhs; end = condExpr; - while (!ISSPACE(*end) && strchr("!=><", *end) == NULL) + while (*end != '\0' && !ISSPACE(*end) && strchr("!=><", *end) == NULL) end++; lhs = Str_dupi(condExpr, end); condExpr = end; @@ -421,7 +421,7 @@ CondHandleVarSpec(bool doEval) return Err; condExpr += varSpecLen; - if (!ISSPACE(*condExpr) && + if (*condExpr && !ISSPACE(*condExpr) && strchr("!=><", *condExpr) == NULL) { BUFFER buf; diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index dc8f546aac6..ea3660aa47e 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.119 2017/12/05 14:35:12 espie Exp $ */ +/* $OpenBSD: parse.c,v 1.120 2017/12/19 20:44:53 zhuk Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* @@ -582,7 +582,7 @@ found_delimiter(const char *s) if (*p == '\0') break; p++; - } while (!ISSPACE(*p)); + } while (*p != '\0' && !ISSPACE(*p)); /* No better match later on... */ if (*p == '\0') -- 2.20.1