]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(skipcpio): edit skipcpio.c: strstr -> memmem
authorrealtime-neil <neil@rtr.ai>
Mon, 25 Jan 2021 22:44:07 +0000 (22:44 +0000)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Tue, 26 Jan 2021 21:06:15 +0000 (21:06 +0000)
because CPIO_END might follow a NULL byte in buf

skipcpio/skipcpio.c

index 30699816d5c5da312aa77271c68071b79130341e..dea216c57e3839b40d816957bf3c57ee88c38a09 100644 (file)
@@ -72,7 +72,7 @@ int main(int argc, char **argv)
                         if (s <= 0)
                                 break;
 
-                        h = strstr(buf, CPIO_END);
+                        h = memmem(buf, sizeof(buf), CPIO_END, sizeof(CPIO_END));
                         if (h) {
                                 pos = (h - buf) + pos + CPIO_ENDLEN;
                                 fseek(f, pos, SEEK_SET);