diff options
author | truckman <truckman@FreeBSD.org> | 2016-05-20 06:41:26 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2016-05-20 06:41:26 +0000 |
commit | 5c329ee4289a660060ecf596cbc3801e8c819df8 (patch) | |
tree | bd3c8e8694a8bd31cbc323e7e6a4092235adb76a /usr.bin | |
parent | 377e456dcc1bad19ae2a4a655498f6bfb30612df (diff) | |
download | FreeBSD-src-5c329ee4289a660060ecf596cbc3801e8c819df8.zip FreeBSD-src-5c329ee4289a660060ecf596cbc3801e8c819df8.tar.gz |
MFC r299591
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
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mail/fio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/mail/fio.c b/usr.bin/mail/fio.c index 1b0efea..d9d4ee1 100644 --- a/usr.bin/mail/fio.c +++ b/usr.bin/mail/fio.c @@ -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) |