Package: mc
Version: 1:4.6.0-4.6.1-pre3-2
Severity: normal
Tags: patch

Thank you for enabling charset encoding, it's great!
However, small bug causes invalid iconv(3) usage and causes mc segfault
inside glibc. It is a result of wrong iconv outbuf parameter: it points
to buffer, but it should really point to pointer to buffer (char **
instead of char*).

The attached patch fixes the problem (at least for me).

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.11.8
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)

Versions of packages mc depends on:
ii  libc6                       2.3.2.ds1-21 GNU C Library: Shared libraries an
ii  libglib2.0-0                2.6.4-1      The GLib library of C routines
ii  libgpmg1                    1.19.6-20    General Purpose Mouse - shared lib

-- no debconf information
--- mc-4.6.0-4.6.1-pre3/src/charsets.c.orig	2005-05-09 12:07:42.000000000 +0400
+++ mc-4.6.0-4.6.1-pre3/src/charsets.c	2005-05-09 12:07:30.000000000 +0400
@@ -143,13 +143,15 @@
 translate_character (iconv_t cd, char c)
 {
     char obuf[4];
+    char *obufptr;
     size_t ibuflen, obuflen, count;
 
     ICONV_CONST char *ibuf = &c;
     ibuflen = 1;
     obuflen = sizeof(obuf);
 
-    count = iconv (cd, &ibuf, &ibuflen, (char **)&obuf, &obuflen);
+    obufptr = obuf;
+    count = iconv (cd, &ibuf, &ibuflen, (char **)&obufptr, &obuflen);
     if (count != (size_t)(-1) && ibuflen == 0)
 	return obuf[0];
 

Reply via email to