aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-02-02 15:43:11 +0200
committerArnold D. Robbins <arnold@skeeve.com>2017-02-02 15:43:11 +0200
commitec480355cc6c93d36a0ae4b95018389455f11a8d (patch)
treefd16b2b603b6a20f3b65b45f87acbffd9f5cf80a
parentb2db54e6b9bebdce30dabce709ec4bcf4f6aa51e (diff)
parentc54a8ebdc993aa3bf259fa7ab85a0f077a70040c (diff)
downloadegawk-ec480355cc6c93d36a0ae4b95018389455f11a8d.tar.gz
egawk-ec480355cc6c93d36a0ae4b95018389455f11a8d.tar.bz2
egawk-ec480355cc6c93d36a0ae4b95018389455f11a8d.zip
Merge branch 'master' into feature/api-mpfr
-rw-r--r--ChangeLog6
-rw-r--r--awkgram.c3
-rw-r--r--awkgram.y3
3 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a85a3d87..f412ee0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (set_profile_next): Allocate an extra byte at the
+ end for the NUL in case we add a sign. Thanks to Andrew Schorr
+ for making me look at this code.
+
2017-02-01 Arnold D. Robbins <arnold@skeeve.com>
* builtin.c (mbc_char_count): Remove spurious multiplies by
diff --git a/awkgram.c b/awkgram.c
index 5b55cf51..fb6e4825 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -8713,7 +8713,8 @@ set_profile_text(NODE *n, const char *str, size_t len)
{
if (do_pretty_print) {
// extra byte in case need to add minus sign in negate_num
- n->stptr = estrdup(str, len + 1);
+ // and another one for the \0 at the end
+ n->stptr = estrdup(str, len + 2);
n->stptr[len] = '\0';
n->stlen = len;
// Set STRCUR and n->stfmt for use when profiling
diff --git a/awkgram.y b/awkgram.y
index 541cebf1..a9e8f9aa 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -6293,7 +6293,8 @@ set_profile_text(NODE *n, const char *str, size_t len)
{
if (do_pretty_print) {
// extra byte in case need to add minus sign in negate_num
- n->stptr = estrdup(str, len + 1);
+ // and another one for the \0 at the end
+ n->stptr = estrdup(str, len + 2);
n->stptr[len] = '\0';
n->stlen = len;
// Set STRCUR and n->stfmt for use when profiling