Hi,

This bug is still affecting me on Debian wheezy.

Below is my patch to solve the problem; it should be more efficient than
the one previously provided (which uses both strlen and memmove) due to
the fact that it only processes each byte in the memory being shifted
once, as well as not using a separate buffer for copying.

--- mathtex-1.03.orig/mathtex.c
+++ mathtex-1.03/mathtex.c
@@ -3455,7 +3455,9 @@
 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 */
+  { char *pfrom = from;
+    for ( ; *pfrom != '\0'; pfrom++ )
+      *pfrom = *(pfrom+nshift); }
 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 */

 - Steven


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

Reply via email to