sfdisk: remove unnecessary size check [cppcheck]

Following warning is false positive.  Size of the buffer is defined using
BUFSIZ, and so the strncpy() will never overwrite the last byte that is
initialized to zero in get_user_reply().

[disk-utils/sfdisk.c:137] -> [disk-utils/sfdisk.c:136]: (warning) Either the
condition 'bufsz!=0' is redundant or strncpy() argument nr 3 can have
invalid value.  The value is -1 but the valid values are '0:'.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2019-05-18 21:46:08 +01:00
parent 4ac2ab97d1
commit 84f46d1f67
No known key found for this signature in database
GPG Key ID: 0D46FEF7E61DBB46
1 changed files with 0 additions and 2 deletions

View File

@ -134,8 +134,6 @@ static int get_user_reply(const char *prompt, char *buf, size_t bufsz)
if (!p)
return 1;
strncpy(buf, p, bufsz - 1);
if (bufsz != 0)
buf[bufsz - 1] = '\0';
free(p);
} else
#endif