mirror of
https://github.com/dynup/kpatch
synced 2025-03-11 05:07:53 +00:00
livepatch-patch-hook: check for object->name before calling strcmp
Fixes issue #494. A null pointer dereference can result with patch modules for multiple objects since the "vmlinux" patch object's "name" field is null. strcmp therefore crashes trying to compare object->name if the current object is vmlinux and the supplied "name" argument is not. Check that object->name is not null before invoking strcmp.
This commit is contained in:
parent
403490fff5
commit
9e223369ea
@ -91,7 +91,7 @@ static struct patch_object *patch_find_object_by_name(const char *name)
|
||||
|
||||
list_for_each_entry(object, &patch_objects, list)
|
||||
if ((!strcmp(name, "vmlinux") && !object->name) ||
|
||||
!strcmp(object->name, name))
|
||||
(object->name && !strcmp(object->name, name)))
|
||||
return object;
|
||||
return patch_alloc_new_object(name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user