mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 11:44:16 +00:00
Merge pull request #4288 from qlyoung/checkpatch-unsafe-function-lints
tools: add lints for unsafe functions
This commit is contained in:
commit
3ae6477f50
@ -6347,6 +6347,35 @@ sub process {
|
||||
"Please, only use 32 bit atomics.\n" . $herecurr);
|
||||
}
|
||||
|
||||
# check for use of strcpy()
|
||||
if ($line =~ /\bstrcpy\s*\(.*\)/) {
|
||||
ERROR("STRCPY",
|
||||
"strcpy() is error-prone; please use strlcpy()" . $herecurr);
|
||||
}
|
||||
|
||||
# check for use of strncpy()
|
||||
if ($line =~ /\bstrncpy\s*\(.*\)/) {
|
||||
WARN("STRNCPY",
|
||||
"strncpy() is error-prone; please use strlcpy() if possible, or memcpy()" . $herecurr);
|
||||
}
|
||||
|
||||
# check for use of strcat()
|
||||
if ($line =~ /\bstrcat\s*\(.*\)/) {
|
||||
ERROR("STRCAT",
|
||||
"strcat() is error-prone; please use strlcat() if possible" . $herecurr);
|
||||
}
|
||||
|
||||
# check for use of strncat()
|
||||
if ($line =~ /\bstrncat\s*\(.*\)/) {
|
||||
WARN("STRNCAT",
|
||||
"strncat() is error-prone; please use strlcat() if possible" . $herecurr);
|
||||
}
|
||||
|
||||
# check for use of bzero()
|
||||
if ($line =~ /\bbzero\s*\(.*\)/) {
|
||||
ERROR("BZERO",
|
||||
"bzero() is deprecated; use memset()" . $herecurr);
|
||||
}
|
||||
}
|
||||
|
||||
# If we have no input at all, then there is nothing to report on
|
||||
|
Loading…
Reference in New Issue
Block a user