Debian Bug#308296: mc segfaults on charset encoding change

Stefano Melchior stefano.melchior at openlabs.it
Mon May 9 16:37:40 UTC 2005


----- Forwarded message from Alexander Vodomerov <alex at sectorb.msk.ru> -----

Date: Mon, 09 May 2005 12:09:26 +0400
From: Alexander Vodomerov <alex at sectorb.msk.ru>
To: Debian Bug Tracking System <submit at bugs.debian.org>
Subject: Bug#308296: mc segfaults on charset encoding change
Reply-To: Alexander Vodomerov <alex at sectorb.msk.ru>, 308296 at bugs.debian.org
Resent-From: Alexander Vodomerov <alex at sectorb.msk.ru>
Resent-To: debian-bugs-dist at lists.debian.org
Resent-Cc: Stefano Melchior <stefano.melchior at openlabs.it>
Resent-Date: Mon, 09 May 2005 08:18:11 UTC
Resent-Message-ID: <handler.308296.B.111562617811966 at bugs.debian.org>
X-Debian-PR-Message: report 308296
X-Debian-PR-Package: mc
X-Debian-PR-Keywords: patch
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
	autolearn=no version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 
Resent-Sender: Debian BTS <debbugs at bugs.debian.org>

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];
 


----- End forwarded message -----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20050509/1cde0f9e/attachment.asc>


More information about the mc-devel mailing list