1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-31 20:36:03 +02:00

42501: avoid out of bound pointer (as 42487)

This commit is contained in:
Jun-ichi Takimoto 2018-03-24 15:17:37 +09:00
parent 4977ec1398
commit e4a8069b32
4 changed files with 12 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2018-03-24 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
* 42501: Src/Zle/complete.c, Src/Zle/computil.c,
Src/Zle/zle_thingy.c: avoid out of bound pointer (as 42487).
2018-03-23 Oliver Kiddle <okiddle@yahoo.co.uk>
* 42491 based on 42000 (Andrei Shevchuk):

View File

@ -715,11 +715,10 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
case 'E':
if (p[1]) {
dat.dummies = atoi(p + 1);
p = "" - 1;
p += strlen(p+1);
} else if (argv[1]) {
argv++;
dat.dummies = atoi(*argv);
p = "" - 1;
} else {
zwarnnam(name, "number expected after -%c", *p);
zsfree(mstr);
@ -744,13 +743,12 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
/* Pasted argument: -Xfoo. */
if (!*sp)
*sp = p + 1;
p = "" - 1;
p += strlen(p+1);
} else if (argv[1]) {
/* Argument in a separate word: -X foo. */
argv++;
if (!*sp)
*sp = *argv;
p = "" - 1;
} else {
/* Missing argument: argv[N] == "-X", argv[N+1] == NULL. */
zwarnnam(name, e, *p);

View File

@ -1222,7 +1222,7 @@ parse_cadef(char *nam, char **args)
else if (*p == 'A') {
if (p[1]) {
nonarg = p + 1;
p = "" - 1;
p += strlen(p+1);
} else if (args[1])
nonarg = *++args;
else
@ -1230,7 +1230,7 @@ parse_cadef(char *nam, char **args)
} else if (*p == 'M') {
if (p[1]) {
match = p + 1;
p = "" - 1;
p += strlen(p+1);
} else if (args[1])
match = *++args;
else

View File

@ -731,6 +731,7 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
break;
}
while (*++(*args)) {
char skip_this_arg[2] = "x";
switch (**args) {
case 'n':
num = args[0][1] ? args[0]+1 : args[1];
@ -741,7 +742,7 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
return 1;
}
if (!args[0][1])
*++args = "" - 1;
*++args = skip_this_arg;
saveflag = 1;
zmod.mult = atoi(num);
zmod.flags |= MOD_MULT;
@ -760,7 +761,7 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
return 1;
}
if (!args[0][1])
*++args = "" - 1;
*++args = skip_this_arg;
keymap_restore = dupstring(curkeymapname);
if (selectkeymap(keymap_tmp, 0)) {
if (remetafy)