]> git.ipfire.org Git - thirdparty/mdadm.git/commit
Replace snprintf with strncpy at some places to avoid truncation
authorXiao Ni <xni@redhat.com>
Sat, 18 Mar 2017 02:33:44 +0000 (10:33 +0800)
committerJes Sorensen <Jes.Sorensen@gmail.com>
Tue, 28 Mar 2017 17:54:43 +0000 (13:54 -0400)
commit618f4e6d63c8c09d8d4002770e44617f3477f137
tree870339f3d5ec09930ee8f19ed961445dc4aadc9e
parent75dd32a185871fead13cd3586e00980b35410ff0
Replace snprintf with strncpy at some places to avoid truncation

In gcc7 there are some building errors like:
directive output may be truncated writing up to 31 bytes into a region of size 24
snprintf(str, MPB_SIG_LEN, %s, mpb->sig);

It just need to copy one string to target. So use strncpy to replace it.

For this line code: snprintf(str, MPB_SIG_LEN, %s, mpb->sig);
Because mpb->sig has the content of version after magic, so
it's better to use strncpy to replace snprintf too.

Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
super-intel.c