[systemd-devel] [PATCH 2/5] sd-id128: properly check position in buffer

Lukas Nykryn lnykryn at redhat.com
Wed Apr 10 03:53:59 PDT 2013


---
 src/libsystemd-id128/sd-id128.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/libsystemd-id128/sd-id128.c b/src/libsystemd-id128/sd-id128.c
index 68c4987..a6345c8 100644
--- a/src/libsystemd-id128/sd-id128.c
+++ b/src/libsystemd-id128/sd-id128.c
@@ -176,6 +176,9 @@ _public_ int sd_id128_get_boot(sd_id128_t *ret) {
                 if (*p == '-')
                         p++;
 
+                if (p >= buf + k - 1)
+                        return -EIO;
+
                 a = unhexchar(p[0]);
                 b = unhexchar(p[1]);
 
-- 
1.8.1.4



More information about the systemd-devel mailing list