Package: mathtex
Version: 1.03-1
Severity: important

Here is a patch for mathtex 1.03:

root@ct101:/home/latex/public_html/mathtex/123# diff -u mathtex.c patched.c
--- mathtex.c   2010-06-11 23:34:25.000000000 +0000
+++ patched.c   2011-04-01 14:28:44.000000000 +0000
@@ -3630,7 +3630,7 @@
 shift from left or right to accommodate replacement of its nfirst chars by to
 -------------------------------------------------------------------------- */
 if ( tolen < nfirst )                  /* shift left is easy */
-  strcpy(from,from+nshift);            /* because memory doesn't overlap */
+  memmove(from,from+nshift,strlen(from+nshift)+1);
 if ( tolen > nfirst )                  /* need more room at start of from */
  { char *pfrom = from+strlen(from);   /* ptr to null terminating from */
    for ( ; pfrom>=from; pfrom-- )     /* shift all chars including null */


What regards this line:
-  strcpy(from,from+nshift);            /* because memory doesn't overlap */

The memory overlaps, indeed. Strings `from` and `from+nshift` shares
strlen(from) - nshift common bytes!
Sometimes it may work (it worked on my Debian Lenny), but on Debian
Squeeze amd64 it produces malformed string as a result.

Using memmove fixes this problem.
+  memmove(from,from+nshift,strlen(from+nshift)+1);


-- System Information:
Debian Release: 6.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-openvz-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages mathtex depends on:
ii  dvipng                        1.13-1     convert DVI files to PNG graphics
ii  libc6                         2.11.2-10  Embedded GNU C Library: Shared lib
ii  texlive                       2009-11    TeX Live: A decent selection of th

mathtex recommends no packages.

mathtex suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to