chiark / gitweb /
tmpfiles: avoid out of bounds read
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Tue, 24 Mar 2015 22:37:48 +0000 (23:37 +0100)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Tue, 24 Mar 2015 22:53:09 +0000 (23:53 +0100)
Otherwise this will go wrong for 'v'.

src/tmpfiles/tmpfiles.c

index 25c8cfa6946e6bfe62c7394289ab1a2b2ec5e8ae..55a6a7bb54505528744983251d80ae5af7e8f71e 100644 (file)
@@ -830,7 +830,7 @@ static int get_attrib_from_arg(Item *item) {
                 return -EINVAL;
         }
         for (; *p ; p++) {
-                if ((uint8_t)*p > ELEMENTSOF(attributes) || attributes[(uint8_t)*p] == 0) {
+                if ((uint8_t)*p >= ELEMENTSOF(attributes) || attributes[(uint8_t)*p] == 0) {
                         log_error("\"%s\": setting ATTR: unknown attr '%c'", item->path, *p);
                         return -EINVAL;
                 }