mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-08 12:01:21 +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>
|
||||
|
||||
* 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
|
||||
in mail checking
|
||||
|
||||
|
|
|
@ -695,13 +695,11 @@ bin_set(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
|
|||
char **a = NULL, **y;
|
||||
int len = arrlen(args);
|
||||
|
||||
if (array < 0 && (a = getaparam(arrayname))) {
|
||||
int al = arrlen(a);
|
||||
|
||||
if (al > len)
|
||||
len = al;
|
||||
if (array < 0 && (a = getaparam(arrayname)) && arrlen_gt(a, len)) {
|
||||
a += len;
|
||||
len += arrlen(a);
|
||||
}
|
||||
for (x = y = zalloc((len + 1) * sizeof(char *)); len--; a++) {
|
||||
for (x = y = zalloc((len + 1) * sizeof(char *)); len--;) {
|
||||
if (!*args)
|
||||
args = a;
|
||||
*y++ = ztrdup(*args++);
|
||||
|
|
Loading…
Reference in a new issue