diff options
author | Fan Du <fan.du@windriver.com> | 2013-09-30 21:09:05 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2013-09-30 21:09:05 -0700 |
commit | 99500b56d94dfa735a3d088fdbdde6c0c2638e78 (patch) | |
tree | 20d68ff187e73d4bcfab7872d5b61c7b32840d9c | |
parent | 101847446e6a5e3ca370e65ebc462584934fce0e (diff) | |
download | iproute2-99500b56d94dfa735a3d088fdbdde6c0c2638e78.tar.gz |
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: Sohny Thomas <sthomas@linux.vnet.ibm.com>
-rw-r--r-- | ip/xfrm_state.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c index 389942c0..f4ad4cb1 100644 --- a/ip/xfrm_state.c +++ b/ip/xfrm_state.c @@ -162,7 +162,7 @@ static int xfrm_algo_parse(struct xfrm_algo *alg, enum xfrm_attr_type_t type, if (len > max) invarg("ALGO-KEYMAT value makes buffer overflow\n", key); - strncpy(buf, key, len); + memcpy(buf, key, len); } } |