utils: account for terminating \0 byte

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2018-05-10 20:25:08 +02:00
parent 2b2655a8c5
commit ccd42a3144
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -2417,7 +2417,7 @@ int parse_byte_size_string(const char *s, int64_t *converted)
if (!s || !strcmp(s, ""))
return -EINVAL;
end = stpncpy(dup, s, sizeof(dup));
end = stpncpy(dup, s, sizeof(dup) - 1);
if (*end != '\0')
return -EINVAL;