chiark / gitweb /
bootctl: check that partition uuid is valid
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Wed, 25 Feb 2015 22:10:35 +0000 (23:10 +0100)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Wed, 25 Feb 2015 22:32:50 +0000 (23:32 +0100)
It probably is but check anyway to make coverity happy.

CID#1271354

src/boot/bootctl.c

index fb568bebbe7269f174b1bf4b62ab0c1de3366bc0..bd55fa95b028591ccc463dd3dcc3ff143ad90b3f 100644 (file)
@@ -177,7 +177,13 @@ static int verify_esp(const char *p, uint32_t *part, uint64_t *pstart, uint64_t
                 fprintf(stderr, "Failed to probe partition entry UUID %s: %s\n", p, strerror(-r));
                 goto fail;
         }
                 fprintf(stderr, "Failed to probe partition entry UUID %s: %s\n", p, strerror(-r));
                 goto fail;
         }
-        sd_id128_from_string(v, uuid);
+
+        r = sd_id128_from_string(v, uuid);
+        if (r < 0) {
+                fprintf(stderr, "Partition %s has invalid UUID: %s\n", p, v);
+                r = -EIO;
+                goto fail;
+        }
 
         errno = 0;
         r = blkid_probe_lookup_value(b, "PART_ENTRY_NUMBER", &v, NULL);
 
         errno = 0;
         r = blkid_probe_lookup_value(b, "PART_ENTRY_NUMBER", &v, NULL);