From 243157ae345f32b06f9c1a223139891339d0ad82 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 4 Sep 2012 15:15:42 +0200 Subject: s3: in sys_popen(), validate input before opening the pipe. --- source3/lib/system.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/lib/system.c') diff --git a/source3/lib/system.c b/source3/lib/system.c index 8c9c05f4de..ce55e83d58 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -1161,17 +1161,17 @@ int sys_popen(const char *command) char **argl = NULL; int ret; + if (!*command) { + errno = EINVAL; + return -1; + } + if (pipe(pipe_fds) < 0) return -1; parent_end = pipe_fds[0]; child_end = pipe_fds[1]; - if (!*command) { - errno = EINVAL; - goto err_exit; - } - if((entry = SMB_MALLOC_P(popen_list)) == NULL) goto err_exit; -- cgit