mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
checkpatch: Check for unsafe string functions
There are many string based functions that are unsafe to use. Some of the functions are unsafe to use because of the possibility of overflow while others cannot guarantee that the resultant string is NULL-terminated. Add check for these functions and log message indicating which safe functions can be used instead. Change-Id: Id305d98df241e3fd257529529739dcd4f3659186 Signed-off-by: Olav Haugan <ohaugan@codeaurora.org> (cherry picked from commit 665be0da353f69f85cb1acea19279adf6ccb5b52)
This commit is contained in:
parent
097d733966
commit
fa79a44270
1 changed files with 5 additions and 2 deletions
|
@ -3352,8 +3352,11 @@ sub process {
|
|||
# unbounded string functions are overflow risks
|
||||
my %str_fns = (
|
||||
"sprintf" => "snprintf",
|
||||
"strcpy" => "strncpy",
|
||||
"strcat" => "strncat",
|
||||
"strcpy" => "strlcpy",
|
||||
"strncpy" => "strlcpy",
|
||||
"strcat" => "strlcat",
|
||||
"strncat" => "strlcat",
|
||||
"vsprintf" => "vsnprintf",
|
||||
"strcmp" => "strncmp",
|
||||
"strcasecmp" => "strncasecmp",
|
||||
"strchr" => "strnchr",
|
||||
|
|
Loading…
Reference in a new issue