aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-02-05 21:34:36 +0200
committerArnold D. Robbins <arnold@skeeve.com>2017-02-05 21:34:36 +0200
commit8983808f8767f1011667437ea7452ffe5fd26afd (patch)
treed52c528432e3bde3d4ea252446a52d97eb4dbfa4 /awkgram.c
parentf562da9f76aece5cf0692fef03e0b3713249a652 (diff)
parent21cc2dc13d48aaa70b88d7a190ea8b4b830986f4 (diff)
downloadegawk-8983808f8767f1011667437ea7452ffe5fd26afd.tar.gz
egawk-8983808f8767f1011667437ea7452ffe5fd26afd.tar.bz2
egawk-8983808f8767f1011667437ea7452ffe5fd26afd.zip
Merge branch 'master' into feature/stringfix
Diffstat (limited to 'awkgram.c')
-rw-r--r--awkgram.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/awkgram.c b/awkgram.c
index 70ff6daa..f4043923 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -8712,9 +8712,10 @@ static NODE *
set_profile_text(NODE *n, const char *str, size_t len)
{
if (do_pretty_print) {
- // extra byte in case we need to add minus sign in negate_num
- // note that estrdup adds another byte for the \0 at the end
- n->stptr = estrdup(str, len + 1);
+ // two extra bytes: one for NUL termination, and another in
+ // case we need to add a leading minus sign in add_sign_to_num
+ emalloc(n->stptr, char *, len + 2, "set_profile_text");
+ memcpy(n->stptr, str, len);
n->stptr[len] = '\0';
n->stlen = len;
// Set STRCUR and n->stfmt for use when profiling