summaryrefslogtreecommitdiffstats
path: root/contrib/awk/builtin.c
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>2000-09-04 10:42:19 +0000
committersheldonh <sheldonh@FreeBSD.org>2000-09-04 10:42:19 +0000
commit8af19a0efa7cda30270bff0275dc1ebe3f9ea024 (patch)
treeab50245fbcf35a1ce59e1a90e67cbab90b1d6381 /contrib/awk/builtin.c
parenta3f7b962cd5bd808c44ab10f9167907d008e96b4 (diff)
downloadFreeBSD-src-8af19a0efa7cda30270bff0275dc1ebe3f9ea024.zip
FreeBSD-src-8af19a0efa7cda30270bff0275dc1ebe3f9ea024.tar.gz
Fix bug that causes gawk to choke when parsing long source files.
Reported by: Tony Fleisher <takhus@takhus.mind.net> Submitted by: Aharon Robbins <arnold@skeeve.com>
Diffstat (limited to 'contrib/awk/builtin.c')
-rw-r--r--contrib/awk/builtin.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/awk/builtin.c b/contrib/awk/builtin.c
index 89babb3..fc9365b 100644
--- a/contrib/awk/builtin.c
+++ b/contrib/awk/builtin.c
@@ -2104,9 +2104,11 @@ size_t len;
retval = (retval * 16) + val;
}
} else if (*str == '0') {
+ if (strchr(str, '8') != NULL || strchr(str, '9') != NULL)
+ goto decimal;
for (; len > 0; len--) {
- if (! isdigit(*str) || *str == '8' || *str == '9')
- goto decimal;
+ if (! isdigit(*str))
+ goto done;
retval = (retval * 8) + (*str - '0');
str++;
}
OpenPOWER on IntegriCloud