Add strncpy to the list of banned functions
strncpy does not guarantee that the resulting strings are null terminated, which leads to mistakes. It's always better to use a function like snprintf instead, so ban it. Change-Id: I6ca56103a35df3364a04bdd68937768bc0479235 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/407027 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
e450a34aa9
commit
bdfeddd3a3
@ -77,7 +77,7 @@ rm -f whitespace.log
|
||||
|
||||
echo -n "Checking for use of forbidden library functions..."
|
||||
|
||||
git grep --line-number -w '\(strcpy\|sprintf\|vsprintf\)' -- './*.c' ':!lib/vhost/rte_vhost*/**' > badfunc.log || true
|
||||
git grep --line-number -w '\(strncpy\|strcpy\|sprintf\|vsprintf\)' -- './*.c' ':!lib/vhost/rte_vhost*/**' > badfunc.log || true
|
||||
if [ -s badfunc.log ]; then
|
||||
echo " Forbidden library functions detected"
|
||||
cat badfunc.log
|
||||
|
Loading…
x
Reference in New Issue
Block a user