summaryrefslogtreecommitdiff
path: root/source3/lib/system.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2012-09-04 15:15:42 +0200
committerMichael Adam <obnox@samba.org>2012-09-04 20:39:20 +0200
commit243157ae345f32b06f9c1a223139891339d0ad82 (patch)
tree4f63e0ba7cf1d8471ba0ab07abb9955c1e7dbf48 /source3/lib/system.c
parente7d385c366f04586c6e1490ea0a8cd4b1225f552 (diff)
downloadsamba-243157ae345f32b06f9c1a223139891339d0ad82.tar.gz
samba-243157ae345f32b06f9c1a223139891339d0ad82.tar.bz2
samba-243157ae345f32b06f9c1a223139891339d0ad82.zip
s3: in sys_popen(), validate input before opening the pipe.
Diffstat (limited to 'source3/lib/system.c')
-rw-r--r--source3/lib/system.c10
1 files changed, 5 insertions, 5 deletions
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;