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:
parent
b7c544c759
commit
62f0d851a8
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user