aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--awkgram.c1
-rw-r--r--awkgram.y1
3 files changed, 6 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f4b1c777..a48d4cf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
2019-06-21 Arnold D. Robbins <arnold@skeeve.com>
* config.guess, config.sub: Updated from GNULIB.
+ * awkgram.y (get_src_buf): Set buffers to zero to avoid
+ possible issues with accessing uninitialized memory.
+ Thanks to valgrind, as pointed out by Nadezhda Vyukova
+ <qniva@yandex.ru>.
2019-06-19 Arnold D. Robbins <arnold@skeeve.com>
diff --git a/awkgram.c b/awkgram.c
index 68cee61a..061d2975 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -5682,6 +5682,7 @@ get_src_buf()
sourcefile->bufsize = l;
newfile = true;
emalloc(sourcefile->buf, char *, sourcefile->bufsize, "get_src_buf");
+ memset(sourcefile->buf, '\0', sourcefile->bufsize); // keep valgrind happy
lexptr = lexptr_begin = lexeme = sourcefile->buf;
savelen = 0;
sourceline = 1;
diff --git a/awkgram.y b/awkgram.y
index 3cbcfd31..a940ac9d 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -3185,6 +3185,7 @@ get_src_buf()
sourcefile->bufsize = l;
newfile = true;
emalloc(sourcefile->buf, char *, sourcefile->bufsize, "get_src_buf");
+ memset(sourcefile->buf, '\0', sourcefile->bufsize); // keep valgrind happy
lexptr = lexptr_begin = lexeme = sourcefile->buf;
savelen = 0;
sourceline = 1;