This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=3e8fbeac09366e7fbfce51251351c5650e323a14 commit 3e8fbeac09366e7fbfce51251351c5650e323a14 Author: Guillem Jover <[email protected]> AuthorDate: Sat Jan 27 23:57:49 2024 +0100 libdpkg: Add comment clarifying GNU long name format expectations We have fixed the portability issues with the terminating NUL character, but we should make it explicit in the comment describing the GNU long names format. --- lib/dpkg/tarfn.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c index d999db68e..48e3c384a 100644 --- a/lib/dpkg/tarfn.c +++ b/lib/dpkg/tarfn.c @@ -348,10 +348,15 @@ tar_header_decode(struct tar_header *h, struct tar_entry *d, struct dpkg_error * * The way the GNU long{link,name} stuff works is like this: * * - The first header is a “dummy” header that contains the size of the - * filename. - * - The next N headers contain the filename. + * filename (GNU tar includes the terminating NUL character in the size, + * but other implementations do not). + * - The next N headers contain the filename (GNU tar terminates the string + * with a NUL character, but other implementations do not). * - After the headers with the filename comes the “real” header with a * bogus name or link. + * + * To be robust against any input, we need to always terminate the filename + * with a NUL character. */ static int tar_gnu_long(struct tar_archive *tar, struct tar_entry *te, char **longp) -- Dpkg.Org's dpkg

