aboutsummaryrefslogtreecommitdiffstats
path: root/mpfr.c
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2016-06-26 21:10:25 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2016-06-26 21:10:25 -0400
commita7b4445ceb1d355911a8a367b8db79b225094c43 (patch)
treea8c6db4710384cae3a8d8da228c018c1b8538c7f /mpfr.c
parent2b0495afae3d744127f3b6c18e98819feafbface (diff)
downloadegawk-a7b4445ceb1d355911a8a367b8db79b225094c43.tar.gz
egawk-a7b4445ceb1d355911a8a367b8db79b225094c43.tar.bz2
egawk-a7b4445ceb1d355911a8a367b8db79b225094c43.zip
When checking for trailing spaces in numeric strings, avoid running off the end.
Diffstat (limited to 'mpfr.c')
-rw-r--r--mpfr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mpfr.c b/mpfr.c
index b15c9b0b..f2c58116 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -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)