chiark / gitweb /
sd-id128: check that the kernel is feeding us proper data
[elogind.git] / src / libsystemd-id128 / sd-id128.c
index 4286ae7d146027b40b03378151387d8f8d0a4a1e..68c4987149d5ead483f5e803cd47a884a8890010 100644 (file)
@@ -170,6 +170,9 @@ _public_ int sd_id128_get_boot(sd_id128_t *ret) {
         for (j = 0, p = buf; j < 16; j++) {
                 int a, b;
 
         for (j = 0, p = buf; j < 16; j++) {
                 int a, b;
 
+                if (p >= buf + k)
+                        return -EIO;
+
                 if (*p == '-')
                         p++;
 
                 if (*p == '-')
                         p++;