On Sat, 19 Apr 2014 23:49:15 -0400, Ken Hornstein writes:
>This release include a few bug fixes to RC1, including fixes for SASL
>support and scan line corruption when using inc(1) with POP or Maildir.
>Please see the NEWS file for the list of changes since the 1.5 release.

i've just finished the packaging of nmh 1.6 rc2 for debian, and found 
two bugs:

. with locale iso-8859-1 mhshow fails to display an
  utf-8 encoded mail and test/mhshow/test-subpart fails.

  mhshow reports 
         mhshow: Can't convert utf-8 to ISO-8859-
         mhshow: unable to convert character set of part 1.1 
         to utf-8, continuing...
 
  yes, the error message *really* shows the charset incorrectly,
  without the trailing 1.

  i've traced this back to norm_charmap(). most of the time it returns 
  just static strings (or the original input), but for charsets 
  containing "8859-" or "CP12" it uses, returns and reuses the same 
  static string buffer.

  because the calling code does not copy norm_charmap's output away
  safely ( but instead does fun things like
  strcmp(norm_charmap(source),norm_charmap(dest)) ) subsequent calls to
  norm_charmap then destroy the result of the previous one 
  if charsets win-1252 or iso-8859-x are involved. 
  
  the dud "ISO-8859-" is the buffer initializer which i
  believe is caused by norm_charmap being asked to work on its own output.

  i've fixed this by malloc()ing that buffer; see attached patch.

. the lzma in debian (9.22-2) refuses to uncompress a file named '11.tar'
  even with -cdf based on the file's extension; 
  this breaks test/post/test-sendfiles. for now i've disabled 
  lzma compression as a test option for this test.

regards
az

Description: repair problematic static buffer returned by norm_charmap()
Author: Alexander Zangerl <[email protected]>

--- a/sbr/norm_charmap.c
+++ b/sbr/norm_charmap.c
@@ -28,12 +28,10 @@
 
 #define digit(x) ((x) >= '0' && (x) <= '9')
 
-static char buf[16];
-
 char *
 norm_charmap(char *name)
 {
-  char *p;
+  char *p, *buf;
   
   if (!name)
     return name;
@@ -73,6 +71,9 @@ norm_charmap(char *name)
 
   /* ISO 8859 will be converted to "ISO-8859-x" */
   if ((p = strstr(name, "8859-"))) {
+    /* mustn't overwrite previous norm_charmap results, so dynamic buffer */
+    if (!(buf=malloc(16)))
+       return buf;
     memcpy(buf, "ISO-8859-\0\0", 12);
     p += 5;
     if (digit(*p)) {
@@ -80,10 +81,14 @@ norm_charmap(char *name)
       if (digit(*p)) buf[10] = *p++;
       return buf;
     }
+    free(buf);			/* free mem if dud input */
   }
 
   /* Windows code pages will be converted to "WINDOWS-12xx" */
   if ((p = strstr(name, "CP12"))) {
+    /* mustn't overwrite previous norm_charmap results, so dynamic buffer */
+    if (!(buf=malloc(16)))
+       return buf;
     memcpy(buf, "WINDOWS-12\0\0", 13);
     p += 4;
     if (digit(*p)) {
@@ -91,6 +96,7 @@ norm_charmap(char *name)
       if (digit(*p)) buf[11] = *p++;
       return buf;
     }
+    free(buf); 			/* free mem if dud input */
   }
 
   /* TIS-620 comes in at least the following two forms */
-- 
Alexander Zangerl + GPG Key 0xB963BD5F (or 0x42BD645D) + http://snafu.priv.at/
I halve a spelling chequer - It came with my pea sea -
It plane lee marques four my revue - Miss steaks aye ken knot sea
 -- J.S. Tenn, Owed to a Spell Chequer

Attachment: signature.asc
Description: Digital Signature

_______________________________________________
Nmh-workers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/nmh-workers

Reply via email to