Bläddra i källkod

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

Frank Lichtenheld 20 år sedan
förälder
incheckning
4f02e2f8a1
3 ändrade filer med 15 tillägg och 4 borttagningar
  1. 8 0
      ChangeLog
  2. 3 0
      debian/changelog
  3. 4 4
      src/archives.c

+ 8 - 0
ChangeLog

@@ -1,5 +1,13 @@
 2006-04-11  Frank Lichtenheld  <djpig@debian.org>
 
+	* 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.

+ 3 - 0
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)

+ 4 - 4
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;
                                }
                        }
                }