summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Kinder <nkinder@redhat.com>2010-09-15 08:55:22 -0700
committerNathan Kinder <nkinder@redhat.com>2010-09-15 09:11:06 -0700
commit55f94d2a6a4310bd1cd6bacc71fc4ce50b75a9fa (patch)
tree2ea2f850b41fc565ea446e7df8da57b8a49c852d
parent672f38f84a545678c7c84dfd723de292903ee19a (diff)
downloadds-55f94d2a6a4310bd1cd6bacc71fc4ce50b75a9fa.tar.gz
ds-55f94d2a6a4310bd1cd6bacc71fc4ce50b75a9fa.tar.xz
ds-55f94d2a6a4310bd1cd6bacc71fc4ce50b75a9fa.zip
Bug 630097 - (cov#15509) NULL dereference in idsktune
If strdup() fails, the cmd variable will be NULL. We dereference it without checking it strdup() was successful. We should check if cmd is NULL before dereferencing it.
-rw-r--r--ldap/systools/idsktune.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ldap/systools/idsktune.c b/ldap/systools/idsktune.c
index cd4934d9..40f1cf5c 100644
--- a/ldap/systools/idsktune.c
+++ b/ldap/systools/idsktune.c
@@ -1108,6 +1108,11 @@ linux_check_release(void)
char osl[128];
char *cmd = strdup("/bin/uname -r");
+ if (cmd == NULL) {
+ printf("ERROR: Unable to allocate memory\n");
+ goto done;
+ }
+
if (flag_html) printf("<P>\n");
if (flag_debug) printf("DEBUG : %s\n",cmd);
fp = popen(cmd,"r");