[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, feature/stringfix, updated. gawk-4.1.0-2
From: |
Andrew J. Schorr |
Subject: |
[gawk-diffs] [SCM] gawk branch, feature/stringfix, updated. gawk-4.1.0-2421-g4786c70 |
Date: |
Fri, 27 Jan 2017 02:06:17 +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, feature/stringfix has been updated
via 4786c70e08d1856348d1417b863f10861d830d7b (commit)
from c8bfe9cad177f47218999f16bea5cdbe7e3fa7d2 (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=4786c70e08d1856348d1417b863f10861d830d7b
commit 4786c70e08d1856348d1417b863f10861d830d7b
Author: Andrew J. Schorr <address@hidden>
Date: Thu Jan 26 21:06:01 2017 -0500
Protect against some unterminated string situations in interpret.h.
diff --git a/ChangeLog b/ChangeLog
index 68c5719..3c3fdca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2017-01-26 Andrew J. Schorr <address@hidden>
+ * interpret.h (Op_arrayfor_init): Protect against string overrun
+ on sorting method.
+ (Op_indirect_func_call): Terminate function name.
+
+2017-01-26 Andrew J. Schorr <address@hidden>
+
* str_array.c (env_remove): Terminate string before calling unsetenv.
2017-01-26 Andrew J. Schorr <address@hidden>
diff --git a/interpret.h b/interpret.h
index 9661910..460c79d 100644
--- a/interpret.h
+++ b/interpret.h
@@ -886,6 +886,8 @@ mod:
size_t num_elems = 0;
static NODE *sorted_in = NULL;
const char *how_to_sort = "@unsorted";
+ char save;
+ bool saved_end = false;
/* get the array */
array = POP_ARRAY();
@@ -908,11 +910,17 @@ mod:
if (sort_str != NULL) {
sort_str = force_string(sort_str);
- if (sort_str->stlen > 0)
+ if (sort_str->stlen > 0) {
how_to_sort = sort_str->stptr;
+ save = sort_str->stptr[sort_str->stlen];
+ sort_str->stptr[sort_str->stlen] = '\0';
+ saved_end = true;
+ }
}
list = assoc_list(array, how_to_sort, SORTED_IN);
+ if (saved_end)
+ sort_str->stptr[sort_str->stlen] = save;
arrayfor:
getnode(r);
@@ -1049,6 +1057,7 @@ match_re:
{
NODE *f = NULL;
int arg_count;
+ char save;
arg_count = (pc + 1)->expr_count;
t1 = PEEK(arg_count); /* indirect var */
@@ -1057,12 +1066,15 @@ match_re:
fatal(_("indirect function call requires a
simple scalar value"));
t1 = force_string(t1);
+ save = t1->stptr[t1->stlen];
+ t1->stptr[t1->stlen] = '\0';
if (t1->stlen > 0) {
/* retrieve function definition node */
f = pc->func_body;
if (f != NULL && strcmp(f->vname, t1->stptr) ==
0) {
/* indirect var hasn't been reassigned
*/
+ t1->stptr[t1->stlen] = save;
ni = setup_frame(pc);
JUMPTO(ni); /* Op_func */
}
@@ -1087,10 +1099,12 @@ match_re:
r = call_split_func(t1->stptr,
arg_count);
else
r = the_func(arg_count);
+ t1->stptr[t1->stlen] = save;
PUSH(r);
break;
} else if (f->type != Node_func) {
+ t1->stptr[t1->stlen] = save;
if (f->type == Node_ext_func) {
/* code copied from below, keep in sync
*/
INSTRUCTION *bc;
@@ -1115,6 +1129,7 @@ match_re:
pc->func_name);
}
pc->func_body = f; /* save for next call */
+ t1->stptr[t1->stlen] = save;
ni = setup_frame(pc);
JUMPTO(ni); /* Op_func */
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 6 ++++++
interpret.h | 17 ++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, feature/stringfix, updated. gawk-4.1.0-2421-g4786c70,
Andrew J. Schorr <=