quotasys.c: fix strncpy usage

When quota is configured using --enable-werror, gcc -flto fails with
the following diagnostics:

In function 'strncpy',
    inlined from 'sstrncpy' at common.c:107:2,
    inlined from 'copy_mntoptarg' at quotasys.c:774:3,
    inlined from 'copy_mntoptarg' at quotasys.c:769:13:
/usr/include/bits/string_fortified.h:91:10: error: '__builtin_strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
   91 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^
quotasys.c: In function 'copy_mntoptarg':
quotasys.c:774:25: note: length computed here
  774 |   sstrncpy(buf, optarg, min(buflen, strlen(optarg) + 1));
      |                         ^

This diagnostics is correct: strcpy() copies at most "len" bytes of the string
pointed to by "src", including the terminating null byte, to the buffer
pointed to by "dest".

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Jan Kara <jack@suse.cz>
1 file changed