From 4f02e2f8a13a266b8200b90b6e52c6f2c5c7330c Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 10 Apr 2006 23:49:45 +0000 Subject: [PATCH] Fix typo in variable name. If hit, this could lead to a infinite loop and OOM in varbufvprintf. (A good way to hit it is installing files with long non-ASCII filenames in UTF-8 locales). Fixed also some typos in the comment for this function. Closes: #346436 --- ChangeLog | 8 ++++++++ debian/changelog | 3 +++ src/archives.c | 8 ++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index d31bc278..f512421f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2006-04-11 Frank Lichtenheld + * src/archives.c (quote_filename): Fix typo in + variable name. If hit, this could lead to a + infinite loop and OOM in varbufvprintf. (A + good way to hit it is installing files with + long non-ASCII filenames in UTF-8 locales). + Fixed also some typos in the comment for this + function. + * scripts/dpkg-scanpackages.pl: Add -follow to @find_args. This was lost in a previous patch apparently. diff --git a/debian/changelog b/debian/changelog index 5aa563b5..aa45cfd7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ dpkg (1.13.19~) UNRELEASED; urgency=low [ Frank Lichtenheld ] * Add -follow (back) to find call in dpkg-scanpackages. Closes: #358011 + * Fix error in archive.c that lead to a infinite loop when + installing files with long, non-ASCII filenames in + certain locales. Closes: #346436 [ Updated dpkg Translations ] * French (Christian Perrier) diff --git a/src/archives.c b/src/archives.c index 7b1e9695..a0a5c35b 100644 --- a/src/archives.c +++ b/src/archives.c @@ -63,14 +63,14 @@ int cflict_index = 0; * file, is not ok, because * - fd_fd_copy() == buffer_copy_setup() [include/dpkg.h] * - buffer_copy_setup() uses varbufvprintf(&v, desc, al); [lib/mlib.c] - * - varbufvpprintf() fails and memory exausted, because it call + * - varbufvprintf() fails and memory exausted, because it call * fmt = "backend dpkg-deb during `%.255s' * arg may contain some invalid char, for example, * /usr/share/doc/console-tools/examples/unicode/\342\231\252\342\231\254 * in console-tools. * In this case, if user uses some locale which doesn't support \342\231..., - * vsnprintf() always return -1 and varbufextend() again and again - * and memory exausted and die. + * vsnprintf() always returns -1 and varbufextend() get called again + * and again until memory is exausted and it aborts. * * So, we need to escape invalid char, probably as in * tar-1.13.19/lib/quotearg.c: quotearg_buffer_restyled() @@ -105,7 +105,7 @@ quote_filename(char *buf, int size, char *s) } else { /* buffer full */ *buf = '\0'; /* XXX */ - return s; + return r; } } } -- 2.39.5