libudev-util: check length before accesing the array

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit is contained in:
Thomas Hindoe Paaboel Andersen 2015-04-05 08:30:49 +02:00 committed by Anthony G. Basile
parent 9dfdc62113
commit 39de7639b4

View File

@ -227,7 +227,7 @@ int util_replace_whitespace(const char *str, char *to, size_t len)
/* strip leading whitespace */
i = 0;
while (isspace(str[i]) && (i < len))
while ((i < len) && isspace(str[i]))
i++;
j = 0;