Commit 99500b56 authored by Fan Du's avatar Fan Du Committed by Stephen Hemminger

xfrm: use memcpy to suppress gcc phony buffer overflow warning.

This bug is reported from below link:
https://bugzilla.redhat.com/show_bug.cgi?id=982761

An simplified command from its original reproducing method in bugzilla:
ip xfrm state add src 10.0.0.2 dst 10.0.0.1 proto ah spi 0x12345678 auth md5 12
will cause below spew from gcc.
Reported-by: default avatarSohny Thomas <sthomas@linux.vnet.ibm.com>
parent 10184744
...@@ -162,7 +162,7 @@ static int xfrm_algo_parse(struct xfrm_algo *alg, enum xfrm_attr_type_t type, ...@@ -162,7 +162,7 @@ static int xfrm_algo_parse(struct xfrm_algo *alg, enum xfrm_attr_type_t type,
if (len > max) if (len > max)
invarg("ALGO-KEYMAT value makes buffer overflow\n", key); invarg("ALGO-KEYMAT value makes buffer overflow\n", key);
strncpy(buf, key, len); memcpy(buf, key, len);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment