mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-06-16 02:35:58 +00:00
udev: check more builtins[] pointers before dereferencing
Fix some more locations where pointers from builtins[] are dereferenced
before checking. Related to 8cacf69b1.
This commit is contained in:
@@ -89,10 +89,16 @@ void udev_builtin_list(struct udev *udev) {
|
||||
}
|
||||
|
||||
const char *udev_builtin_name(enum udev_builtin_cmd cmd) {
|
||||
if (!builtins[cmd])
|
||||
return NULL;
|
||||
|
||||
return builtins[cmd]->name;
|
||||
}
|
||||
|
||||
bool udev_builtin_run_once(enum udev_builtin_cmd cmd) {
|
||||
if (!builtins[cmd])
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return builtins[cmd]->run_once;
|
||||
}
|
||||
|
||||
@@ -116,6 +122,9 @@ int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const c
|
||||
int argc;
|
||||
char *argv[128];
|
||||
|
||||
if (!builtins[cmd])
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
/* we need '0' here to reset the internal state */
|
||||
optind = 0;
|
||||
strscpy(arg, sizeof(arg), command);
|
||||
|
||||
Reference in New Issue
Block a user