libmultipath: fix -Wstringop-overflow warning in merge_words()
authorMartin Wilck <mwilck@suse.com>
Mon, 24 Jun 2019 09:27:29 +0000 (11:27 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 3 Jul 2019 06:30:37 +0000 (08:30 +0200)
commit5634993b35873b9a74433f3e103af08f1caa771d
tree0fb7d786dfdf555d5bae3b8541342c82a0d0ecda
parenta3b3095878074bc97b6ebd3d68f39357d331d36d
libmultipath: fix -Wstringop-overflow warning in merge_words()

Fixes the following warning from gcc 9:

In file included from /usr/include/string.h:494,
                 from dmparser.c:8:
In function ‘strncpy’,
    inlined from ‘merge_words’ at dmparser.c:41:2:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
                 specified bound depends on the length of the source argument
                 [-Wstringop-overflow=]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dmparser.c: In function ‘merge_words’:
dmparser.c:41:19: note: length computed here
   41 |  strncpy(p, word, strlen(word) + 1);
      |                   ^~~~~~~~~~~~

Signed-off-by: Martin Wilck <mwilck@suse.com>
libmultipath/dmparser.c