diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-10-11 11:13:27 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-10-11 11:54:04 +0200 |
commit | 62f0d851a8ee20067531084567c6f6aa397059e3 (patch) | |
tree | 50864ba4451bd4e0f4907b842eefe36bc8d78e5a /src/boot | |
parent | smbios: move validation of SMBIOS table sizes fully into get_smbios_table() (diff) | |
download | systemd-62f0d851a8ee20067531084567c6f6aa397059e3.tar.xz systemd-62f0d851a8ee20067531084567c6f6aa397059e3.zip |
smbios: make code more readable by introducing a "limit" pointer
Diffstat (limited to 'src/boot')
-rw-r--r-- | src/boot/efi/vmm.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/boot/efi/vmm.c b/src/boot/efi/vmm.c index 5d20b3a195..1d04509a1e 100644 --- a/src/boot/efi/vmm.c +++ b/src/boot/efi/vmm.c @@ -307,9 +307,10 @@ const char* smbios_find_oem_string(const char *name) { assert(left >= type11->header.length); /* get_smbios_table() already validated this */ left -= type11->header.length; + const char *limit = s + left; - for (const char *p = s; p < s + left; ) { - const char *e = memchr(p, 0, s + left - p); + for (const char *p = s; p < limit; ) { + const char *e = memchr(p, 0, limit - p); if (!e || e == p) /* Double NUL byte means we've reached the end of the OEM strings. */ break; |