[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xheader: fix lookup of .-suffixed keyword
From: |
alice |
Subject: |
Re: [PATCH] xheader: fix lookup of .-suffixed keyword |
Date: |
Tue, 18 Jul 2023 17:35:58 +0000 |
On Tue Jul 18, 2023 at 5:21 PM UTC, Sergey Poznyakoff wrote:
> psykose <alice@ayaya.dev> ha escrit:
>
> > str[strlen(str)] returns the NUL byte, not the last character.
>
> That's irrelevant. kwlen below is *not* the length of keyword, but
> that of p->keyword:
>
> > size_t kwlen = strlen (p->keyword);
> > - if (strncmp (p->keyword, keyword, kwlen) == 0 && keyword[kwlen] == '.')
> > + if (strncmp (p->keyword, keyword, kwlen) == 0 && keyword[kwlen - 1] ==
> > '.')
>
> That patch actually breaks the functionality, instead of fixing it.
yeah, noticed it actually breaks the testsuite after...
the actual issue was that
--- a/src/xheader.c
+++ b/src/xheader.c
@@ -1777,5 +1777,8 @@ struct xhdr_tab const xhdr_tab[] = {
they are restored *only once* during extraction later on. */
{ "SCHILY.xattr", xattr_coder, xattr_decoder, 0, true },
+ /* Ignore apk-tools headers */
+ { "APK-TOOLS.", dummy_coder, dummy_decoder, 0, true },
+
{ NULL, NULL, NULL, 0, false }
};
(as a downstream patch)
used to work with 1.34 but no longer works with 1.35, and prints an unknown-
header warning.
i now realise that omitting the trailing `.` makes the strlen match up correctly
(since it will be one ahead, and land on the '.' of the header.) thanks for
looking! sorry for the noise.
>
> Regards,
> Sergey