1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

smbios: make code more readable by introducing a "limit" pointer

This commit is contained in:
Lennart Poettering 2024-10-11 11:13:27 +02:00
parent b7c544c759
commit 62f0d851a8

View File

@ -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;