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
dde1276e8e
commit
090fc1c839
@ -367,10 +367,10 @@ expand(char *name)
|
|||||||
name = savestr(xname);
|
name = savestr(xname);
|
||||||
}
|
}
|
||||||
if (!strpbrk(name, "~{[*?$`'\"\\"))
|
if (!strpbrk(name, "~{[*?$`'\"\\"))
|
||||||
return (name);
|
return (savestr(name));
|
||||||
if (pipe(pivec) < 0) {
|
if (pipe(pivec) < 0) {
|
||||||
warn("pipe");
|
warn("pipe");
|
||||||
return (name);
|
return (NULL);
|
||||||
}
|
}
|
||||||
(void)snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name);
|
(void)snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name);
|
||||||
if ((sh = value("SHELL")) == NULL)
|
if ((sh = value("SHELL")) == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user