Avoid NULL pointer dereference in xf86TokenToOptinfo if token not found
Reported by parfait 1.1 code analyzer:
Error: Null pointer dereference (CWE 476)
Read from null pointer 'p'
at line 746 of hw/xfree86/common/xf86Option.c in function 'xf86TokenToOptName'.
Function 'xf86TokenToOptinfo' may return constant 'NULL' at line 721, called at line 745.
Null pointer introduced at line 721 in function 'xf86TokenToOptinfo'.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
c1c01e3508
commit
08f75d3a96
|
|
@ -743,7 +743,7 @@ xf86TokenToOptName(const OptionInfoRec * table, int token)
|
|||
const OptionInfoRec *p;
|
||||
|
||||
p = xf86TokenToOptinfo(table, token);
|
||||
return p->name;
|
||||
return p ? p->name : NULL;
|
||||
}
|
||||
|
||||
Bool
|
||||
|
|
|
|||
Loading…
Reference in New Issue