]> err.no Git - systemd/commitdiff
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 fb64c13229cfdb384c84ff8d51e4bdbd3bff2c0f..e0670dbae5dcacb525e89db5e8c9eca5370f612d 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;