Commit bdfeddd3 authored by Ben Walker's avatar Ben Walker Committed by Daniel Verkamp
Browse files

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: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/407027


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent e450a34a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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