gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2427-gc54a8e


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2427-gc54a8eb
Date: Thu, 2 Feb 2017 13:42:57 +0000 (UTC)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, master has been updated
       via  c54a8ebdc993aa3bf259fa7ab85a0f077a70040c (commit)
      from  7b46fc2f6243d91e01b6e74fd69b193b4eddb05b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=c54a8ebdc993aa3bf259fa7ab85a0f077a70040c

commit c54a8ebdc993aa3bf259fa7ab85a0f077a70040c
Author: Arnold D. Robbins <address@hidden>
Date:   Thu Feb 2 15:42:25 2017 +0200

    Improve memory hygiene in set_profile_text.

diff --git a/ChangeLog b/ChangeLog
index 8a0dfc3..f9e1cef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-02         Arnold D. Robbins     <address@hidden>
+
+       * 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     <address@hidden>
 
        * builtin.c (mbc_char_count): Remove spurious multiplies by
diff --git a/awkgram.c b/awkgram.c
index 5b55cf5..fb6e482 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 541cebf..a9e8f9a 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

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |    6 ++++++
 awkgram.c |    3 ++-
 awkgram.y |    3 ++-
 3 files changed, 10 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]