mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
ns16550: harden name/value pair parsing
strsep(), unless passed a 1st argument which itself points at a NULL pointer, won't return NULL. Instead if the separator(s) looked for isn't found, that pointed-to field would be updated to hold NULL. Hence the important check in get_token() is for token to be non-NULL after the call (which get_token()'s callers rely upon), while the checking of param_name is left there just in case. Fixes:97fd49a7e0("ns16550: add support for UART parameters to be specifed with name-value pairs") Reported-by: Kamil Frankowicz <kamil.frankowicz@cert.pl> Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com> master commit:b27d3b45c7master date: 2026-04-07 13:53:49 +0200
This commit is contained in:
1 parent
c9ba169b93
commit
f35f0ac0c8
1 file changed
+1
-1
@@ -1472,7 +1472,7 @@ static enum __init serial_param_type get_token(char *token, char **value)
|
||||
unsigned int i;
|
||||
|
||||
param_name = strsep(&token, "=");
|
||||
if ( param_name == NULL )
|
||||
if ( !param_name || !token )
|
||||
return num_serial_params;
|
||||
|
||||
/* Linear search for the parameter. */
|
||||
|
||||