From: Bartosz Golaszewski Date: Tue, 17 Jan 2017 16:21:28 +0000 (+0100) Subject: gpiomon: check if offset is not negative X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9fa5895bb544b4cb683224ffe61685c75f79482c;p=qemu-gpiodev%2Flibgpiod.git gpiomon: check if offset is not negative Signed-off-by: Bartosz Golaszewski --- diff --git a/src/tools/gpiomon.c b/src/tools/gpiomon.c index c8157cc..10e7e35 100644 --- a/src/tools/gpiomon.c +++ b/src/tools/gpiomon.c @@ -15,6 +15,7 @@ #include #include #include +#include static const struct option longopts[] = { { "help", no_argument, NULL, 'h' }, @@ -158,7 +159,7 @@ int main(int argc, char **argv) device = argv[0]; offset = strtoul(argv[1], &end, 10); - if (*end != '\0') + if (*end != '\0' || offset > INT_MAX) die("invalid GPIO offset: %s", argv[1]); timeout.tv_sec = 0;