Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make: return failure in TryParseIntBase0 for em...
details: https://anonhg.NetBSD.org/src/rev/9cc6e038a841
branches: trunk
changeset: 960314:9cc6e038a841
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Mar 14 16:03:04 2021 +0000
description:
make: return failure in TryParseIntBase0 for empty string
No functional change since the only caller of TryParseIntBase0 already
handles all possible parse errors. Without this check, the code just
looked wrong though.
diffstat:
usr.bin/make/var.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (28 lines):
diff -r a48cdc77195e -r 9cc6e038a841 usr.bin/make/var.c
--- a/usr.bin/make/var.c Sun Mar 14 16:00:07 2021 +0000
+++ b/usr.bin/make/var.c Sun Mar 14 16:03:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.864 2021/03/14 15:43:31 rillig Exp $ */
+/* $NetBSD: var.c,v 1.865 2021/03/14 16:03:04 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.864 2021/03/14 15:43:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.865 2021/03/14 16:03:04 rillig Exp $");
typedef enum VarFlags {
VFL_NONE = 0,
@@ -2308,6 +2308,9 @@
errno = 0;
n = strtol(*pp, &end, 0);
+
+ if (end == *pp)
+ return FALSE;
if ((n == LONG_MIN || n == LONG_MAX) && errno == ERANGE)
return FALSE;
if (n < INT_MIN || n > INT_MAX)
Home |
Main Index |
Thread Index |
Old Index