udevadm: fix segfault

Fixes #11416.
This commit is contained in:
Yu Watanabe
2019-01-14 06:34:19 +09:00
parent 227bcd91b4
commit 0eba88dc9f
+2 -2
View File
@@ -144,11 +144,11 @@ static int parse_argv(int argc, char *argv[]) {
slash = strchr(optarg, '/');
if (slash) {
devtype = strdup(devtype + 1);
devtype = strdup(slash + 1);
if (!devtype)
return -ENOMEM;
subsystem = strndup(optarg, devtype - optarg);
subsystem = strndup(optarg, slash - optarg);
} else
subsystem = strdup(optarg);