Always return either a dynamically allocated string or NULL from
expand(). Never return the name parameter, which could be a the buf[] buffer which is allocated on the stack by getdeadletter() and which would then be used after getdeadletter() has returned. Reported by: Coverity CID: 1199383 MFC after: 1 week
This commit is contained in:
parent
7e4340d511
commit
6957aa1da6
@ -367,10 +367,10 @@ expand(char *name)
|
||||
name = savestr(xname);
|
||||
}
|
||||
if (!strpbrk(name, "~{[*?$`'\"\\"))
|
||||
return (name);
|
||||
return (savestr(name));
|
||||
if (pipe(pivec) < 0) {
|
||||
warn("pipe");
|
||||
return (name);
|
||||
return (NULL);
|
||||
}
|
||||
(void)snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name);
|
||||
if ((sh = value("SHELL")) == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user