mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-11 13:01:28 +02:00
42601: tidy up code for set -A/+A to not increment a NULL pointer and to be more efficient
This commit is contained in:
parent
31f7220563
commit
d8753f47bb
2 changed files with 7 additions and 6 deletions
|
@ -1,5 +1,8 @@
|
||||||
2018-04-07 Oliver Kiddle <okiddle@yahoo.co.uk>
|
2018-04-07 Oliver Kiddle <okiddle@yahoo.co.uk>
|
||||||
|
|
||||||
|
* 42601: Src/builtin.c: tidy up code for set -A/+A to not
|
||||||
|
increment a NULL pointer and to be more efficient
|
||||||
|
|
||||||
* 42607, CVE-2018-1100: Src/utils.c: check bounds on buffer
|
* 42607, CVE-2018-1100: Src/utils.c: check bounds on buffer
|
||||||
in mail checking
|
in mail checking
|
||||||
|
|
||||||
|
|
|
@ -695,13 +695,11 @@ bin_set(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
|
||||||
char **a = NULL, **y;
|
char **a = NULL, **y;
|
||||||
int len = arrlen(args);
|
int len = arrlen(args);
|
||||||
|
|
||||||
if (array < 0 && (a = getaparam(arrayname))) {
|
if (array < 0 && (a = getaparam(arrayname)) && arrlen_gt(a, len)) {
|
||||||
int al = arrlen(a);
|
a += len;
|
||||||
|
len += arrlen(a);
|
||||||
if (al > len)
|
|
||||||
len = al;
|
|
||||||
}
|
}
|
||||||
for (x = y = zalloc((len + 1) * sizeof(char *)); len--; a++) {
|
for (x = y = zalloc((len + 1) * sizeof(char *)); len--;) {
|
||||||
if (!*args)
|
if (!*args)
|
||||||
args = a;
|
args = a;
|
||||||
*y++ = ztrdup(*args++);
|
*y++ = ztrdup(*args++);
|
||||||
|
|
Loading…
Reference in a new issue