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>
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index 389942c..f4ad4cb 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -162,7 +162,7 @@
if (len > max)
invarg("ALGO-KEYMAT value makes buffer overflow\n", key);
- strncpy(buf, key, len);
+ memcpy(buf, key, len);
}
}