libudev-util: check length before accesing the array

This commit is contained in:
Thomas Hindoe Paaboel Andersen 2015-04-05 08:30:49 +02:00
parent afbbf1369b
commit 4835f5639a

View file

@ -216,7 +216,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;