diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | awkgram.c | 3 | ||||
-rw-r--r-- | awkgram.y | 3 |
3 files changed, 10 insertions, 2 deletions
@@ -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 @@ -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 @@ -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 |