]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
libudev-util: check length before accesing the array
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Sun, 5 Apr 2015 06:30:49 +0000 (08:30 +0200)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Sun, 5 Apr 2015 06:46:01 +0000 (08:46 +0200)
src/libudev/libudev-util.c

index 0f8f634ca3ff19e7f6053d6ccceb3e4c6d9987d7..f4656277c61029bead2797fb1e942131d347f50b 100644 (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;