summaryrefslogtreecommitdiff
path: root/usr.bin/awk/lib.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2021-11-02 15:29:42 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2021-11-02 15:29:42 +0000
commita1a65f093bdd10ea7df8cb415169ba171719d754 (patch)
treecb37670eddb66148d544041bb06f013fbe6d6df7 /usr.bin/awk/lib.c
parent0459e05d8438c67f37bbb0bb5b8da224f21397ea (diff)
Update awk to October 12, 2021 version.
Fixes a decision bug with trailing stuff in lib.c:is_valid_number. All other fixes were already present.
Diffstat (limited to 'usr.bin/awk/lib.c')
-rw-r--r--usr.bin/awk/lib.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c
index cd84399c9b0..752b66d9a8d 100644
--- a/usr.bin/awk/lib.c
+++ b/usr.bin/awk/lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib.c,v 1.46 2021/06/10 21:01:43 millert Exp $ */
+/* $OpenBSD: lib.c,v 1.47 2021/11/02 15:29:41 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -825,10 +825,17 @@ convert:
if (result != NULL)
*result = r;
- retval = (isspace((uschar)*ep) || *ep == '\0' || trailing_stuff_ok);
+ /*
+ * check for trailing stuff
+ */
+ while (isspace((uschar)*ep))
+ ep++;
if (no_trailing != NULL)
*no_trailing = (*ep == '\0');
+ // return true if found the end, or trailing stuff is allowed
+ retval = *ep == '\0' || trailing_stuff_ok;
+
return retval;
}