From 54c7d1f454801d3053b99c16b2a371934deb0219 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 3 Apr 2013 16:58:16 -0400 Subject: [PATCH] sd-id128: check that the kernel is feeding us proper data The characters are already checked, so we show that we don't trust the kernel. Make sure we don't overrun the buffer too. --- 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 4286ae7d1..68c498714 100644 --- a/src/libsystemd-id128/sd-id128.c +++ b/src/libsystemd-id128/sd-id128.c @@ -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; + if (p >= buf + k) + return -EIO; + if (*p == '-') p++; -- 2.30.2