]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
smbios: make code more readable by introducing a "limit" pointer 34718/head
authorLennart Poettering <lennart@poettering.net>
Fri, 11 Oct 2024 09:13:27 +0000 (11:13 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 11 Oct 2024 09:54:04 +0000 (11:54 +0200)
src/boot/efi/vmm.c

index 5d20b3a195b598ccea866c5174a56a9bb600c621..1d04509a1e8ff13018821d31301d3a9f2b63ee33 100644 (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;