mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 21:23:23 +00:00
user_events: Fix potential uninitialized pointer while parsing field
Ensure name is initialized by default to NULL to prevent possible edge cases that could lead to it being left uninitialized. Add an explicit check for NULL name to ensure edge boundaries. Link: https://lore.kernel.org/bpf/20220224105334.GA2248@kili/ Link: https://lore.kernel.org/linux-trace-devel/20220224181637.2129-1-beaub@linux.microsoft.com Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
parent
9f8e5aee93
commit
173c2049d1
@ -362,6 +362,8 @@ skip_next:
|
||||
*field++ = '\0';
|
||||
depth++;
|
||||
parse:
|
||||
name = NULL;
|
||||
|
||||
while ((part = strsep(&field, " ")) != NULL) {
|
||||
switch (depth++) {
|
||||
case FIELD_DEPTH_TYPE:
|
||||
@ -382,7 +384,7 @@ parse:
|
||||
}
|
||||
}
|
||||
|
||||
if (depth < FIELD_DEPTH_SIZE)
|
||||
if (depth < FIELD_DEPTH_SIZE || !name)
|
||||
return -EINVAL;
|
||||
|
||||
if (depth == FIELD_DEPTH_SIZE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user