diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2017-02-05 21:33:47 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2017-02-05 21:33:47 +0200 |
commit | 6db8cc17cd606740bead639a2d451c400dd83631 (patch) | |
tree | c7ab152670cae8ba5f53d2d0f7291c7b95ec5b1d /awkgram.c | |
parent | 260c2d0fa556c5c79297fa063a3673c1bb814115 (diff) | |
parent | 21cc2dc13d48aaa70b88d7a190ea8b4b830986f4 (diff) | |
download | egawk-6db8cc17cd606740bead639a2d451c400dd83631.tar.gz egawk-6db8cc17cd606740bead639a2d451c400dd83631.tar.bz2 egawk-6db8cc17cd606740bead639a2d451c400dd83631.zip |
Merge branch 'master' into feature/api-mpfr
Diffstat (limited to 'awkgram.c')
-rw-r--r-- | awkgram.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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 |