]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
server: Avoid invalid free() in com_help().
authorAndre Noll <maan@systemlinux.org>
Thu, 3 Feb 2011 08:12:39 +0000 (09:12 +0100)
committerAndre Noll <maan@systemlinux.org>
Thu, 3 Feb 2011 08:12:39 +0000 (09:12 +0100)
If the argument to com_help is not a valid command, we try to free
uninitialized memory which may lead to a segfault.

This bug existed at least since day 1 of the git repo.

command.c

index f61ea57220d2be440728883564734e460f4c110c..1810e5b1f0eb6793a97370604431569431566e2c 100644 (file)
--- a/command.c
+++ b/command.c
@@ -387,10 +387,8 @@ int com_help(int fd, int argc, char * const * argv)
        }
        /* argument given for help */
        cmd = get_cmd_ptr(argv[1], &handler);
-       if (!cmd) {
-               free(handler);
+       if (!cmd)
                return -E_BAD_CMD;
-       }
        perms = cmd_perms_itohuman(cmd->perms);
        ret = send_va_buffer(fd,
                "%s - %s\n\n"