Bug 200319

Summary: Missing error check for function strdup in linux/scripts/mod/modpost.c
Product: Other Reporter: Yuexing Wang (wangyxlandq)
Component: OtherAssignee: other_other
Status: RESOLVED CODE_FIX    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.17.3 Tree: Mainline
Regression: No

Description Yuexing Wang 2018-06-28 03:02:56 UTC
In function handle_modversions ,

680-683,
	char *munged = strdup(symname);
	munged[0] = '_';
	munged[1] = toupper(munged[1]);
	symname = munged;
Function strdup will return a NULL pointer if an error occurs. Thus the return value of strdup should be checked. Otherwise the dereference of munged may be a Null Pointer Deref.