]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: Access correct array
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 20 Oct 2024 12:12:59 +0000 (14:12 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 22 Oct 2024 17:02:56 +0000 (12:02 -0500)
The contents of s and strings are identical at this point, but iterate
over the correct variable nonetheless.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/196
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-elf.c

index 13ef3df75b130834fa72474ee99363f3d765906d..b70a66d4a75cb83dee552e845a1d36c41d8a0d13 100644 (file)
@@ -450,7 +450,7 @@ int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char *
                        continue;
                }
 
-               while (strings[i] == '\0' && i < size)
+               while (i < size && s[i] == '\0')
                        i++;
 
                a[j] = &s[i];