From 54c7d1f454801d3053b99c16b2a371934deb0219 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Wed, 3 Apr 2013 16:58:16 -0400 Subject: 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(+) (limited to 'src/libsystemd-id128') diff --git a/src/libsystemd-id128/sd-id128.c b/src/libsystemd-id128/sd-id128.c index 4286ae7d14..68c4987149 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++; -- cgit v1.2.3-54-g00ecf