summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-03 20:57:30 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-03 20:57:30 -0400
commitcef3566998fcae6936d781e678c309950a8a5787 (patch)
tree7aeed19f50fd9a5eeabc9e80e12b3105f0548a04 /src/libsystemd
parentf88dc3edeb9c49622fcc773cb6153238fe9efbe2 (diff)
sd-id128: do stricter checking of random boot id
If we are bothering to check whether the kernel is not feeding us bad data, we might as well do it properly. CID #1237692.
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-id128/sd-id128.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libsystemd/sd-id128/sd-id128.c b/src/libsystemd/sd-id128/sd-id128.c
index a1e44e6d19..233ffa070b 100644
--- a/src/libsystemd/sd-id128/sd-id128.c
+++ b/src/libsystemd/sd-id128/sd-id128.c
@@ -183,11 +183,14 @@ _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)
+ if (p >= buf + k - 1)
return -EIO;
- if (*p == '-')
+ if (*p == '-') {
p++;
+ if (p >= buf + k - 1)
+ return -EIO;
+ }
a = unhexchar(p[0]);
b = unhexchar(p[1]);