summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-03 16:58:16 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-05 00:17:35 -0400
commit54c7d1f454801d3053b99c16b2a371934deb0219 (patch)
tree0c159c24e240e9068730d8b78edc904e14a91d06
parentff03aed06a42235a87a3d33e7d812be1e9c8161d (diff)
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.
-rw-r--r--src/libsystemd-id128/sd-id128.c3
1 files changed, 3 insertions, 0 deletions
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++;