libudev-util: check length before accesing the array
This commit is contained in:
parent
afbbf1369b
commit
4835f5639a
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue