mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-08 21:17:47 +03:00
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.
This commit is contained in:
parent
f88dc3edeb
commit
cef3566998
@ -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]);
|
||||
|
Loading…
Reference in New Issue
Block a user