summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Layton <jlayton@samba.org>2011-01-05 10:52:19 -0500
committerJeff Layton <jlayton@samba.org>2011-01-05 10:52:19 -0500
commit5979d6dfe7fde7ab05f6bc02e771b4c05d994213 (patch)
tree201f680cbf757f09c47ea3605cc2adec0c468158
parent7075a466159e59a46575739cc89b8d8a8c3ea3bc (diff)
downloadcifs-utils-5979d6dfe7fde7ab05f6bc02e771b4c05d994213.tar.gz
cifs-utils-5979d6dfe7fde7ab05f6bc02e771b4c05d994213.tar.bz2
cifs-utils-5979d6dfe7fde7ab05f6bc02e771b4c05d994213.zip
cifs.upcall: fix crash when trying to free uninitialized var
If cifs.upcall is passed an invalid argument then it will "goto out". The decoded_args struct however is uninitialized at that point so it will usually segfault when trying to free fields in it. Move the initialization up in the function. Signed-off-by: Jeff Layton <jlayton@samba.org>
-rw-r--r--cifs.upcall.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/cifs.upcall.c b/cifs.upcall.c
index 1ffcd7c..34b0638 100644
--- a/cifs.upcall.c
+++ b/cifs.upcall.c
@@ -677,6 +677,7 @@ int main(const int argc, char *const argv[])
const char *oid;
hostbuf[0] = '\0';
+ memset(&arg, 0, sizeof(arg));
openlog(prog, 0, LOG_DAEMON);
@@ -731,8 +732,6 @@ int main(const int argc, char *const argv[])
goto out;
}
- memset(&arg, 0, sizeof(arg));
-
have = decode_key_description(buf, &arg);
SAFE_FREE(buf);
if ((have & DKD_MUSTHAVE_SET) != DKD_MUSTHAVE_SET) {