diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | mpfr.c | 2 | ||||
-rw-r--r-- | node.c | 2 |
3 files changed, 8 insertions, 2 deletions
@@ -1,5 +1,11 @@ 2016-06-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + * node.c (r_force_number): When checking for trailing spaces, protect + against running off the end of the string. + * mpfr.c (force_mpnum): Ditto. + +2016-06-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + * builtin.c (do_print): There's actually no reason to test whether a value is a number, since the STRCUR flag and stfmt value contain all the necessary info, as in awk.h:force_string. @@ -327,7 +327,7 @@ force_mpnum(NODE *n, int do_nondec, int use_locale) IEEE_FMT(n->mpg_numbr, tval); done: /* trailing space is OK for NUMBER */ - while (isspace((unsigned char) *ptr)) + while (ptr < cpend && isspace((unsigned char) *ptr)) ptr++; *cpend = save; if (errno == 0 && ptr == cpend) @@ -136,7 +136,7 @@ r_force_number(NODE *n) } /* POSIX says trailing space is OK for NUMBER */ - while (isspace((unsigned char) *ptr)) + while (ptr < cpend && isspace((unsigned char) *ptr)) ptr++; if (errno == 0) { |