chiark / gitweb /
util_run_program(): fix possible buffer overflow #2
authorFlorian Zumbiehl <florz@florz.de>
Tue, 8 Sep 2009 19:42:21 +0000 (21:42 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Tue, 8 Sep 2009 19:42:21 +0000 (21:42 +0200)
I'm not sure how likely it is for UTIL_PATH_SIZE to have an odd value
(maybe it has right now? :-), but I guess making this universally correct
doesn't hurt ...

libudev/libudev-util-private.c

index fb64c13..e0670db 100644 (file)
@@ -251,7 +251,7 @@ int util_run_program(struct udev *udev, const char *command, char **envp,
        pid_t pid;
        char arg[UTIL_PATH_SIZE];
        char program[UTIL_PATH_SIZE];
-       char *argv[(sizeof(arg) / 2) + 1];
+       char *argv[((sizeof(arg) + 1) / 2) + 1];
        int devnull;
        int i;
        int err = 0;