From: Eric Bollengier Date: Fri, 18 Sep 2015 06:49:27 +0000 (+0200) Subject: Fix segfault in open_bpipe() when the program is empty X-Git-Tag: Release-7.4.0~195 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b22f312a99b3e55f902a70190a4b2a57207aa44a;p=bacula%2Fbacula Fix segfault in open_bpipe() when the program is empty --- diff --git a/bacula/src/lib/bpipe.c b/bacula/src/lib/bpipe.c index 81d673fd69..c0ef83a633 100644 --- a/bacula/src/lib/bpipe.c +++ b/bacula/src/lib/bpipe.c @@ -74,6 +74,12 @@ BPIPE *open_bpipe(char *prog, int wait, const char *mode, char *envp[]) BPIPE *bpipe; int save_errno; + if (!prog || !*prog) { + /* execve(3) A component of the file does not name an existing file or file is an empty string. */ + errno = ENOENT; + return NULL; + } + bpipe = (BPIPE *)malloc(sizeof(BPIPE)); memset(bpipe, 0, sizeof(BPIPE)); mode_read = (mode[0] == 'r');