Description: This patch contains a fix to the problem with corruption of
 strings in amd64 when eglibc is also installed.
Origin: Bill Cheng <bill.cheng@usc.edu> - Upstream
Author: Carlo Segre <segre@debian.org>
Bugs: 595795
Last-Update: 2010-09-10

--- a/auxtext.c
+++ b/auxtext.c
@@ -2029,7 +2029,7 @@
    for (s=Str; *s != '\0'; s++) {
       if (*s == '"') {
          if (s[1] == '"') {
-            strcpy(s, s+1);
+            UtilStrCpy(s, s+1);
          } else {
             break;
          }
@@ -2037,7 +2037,7 @@
          if (s[1] >= '0' && s[1] <= '3') {
             if (s[2] >= '0' && s[2] <= '7' && s[3] >= '0' && s[3] <= '7') {
                *s = (char)(((s[1]-'0')<<6)+((s[2]-'0')<<3)+(s[3]-'0'));
-               strcpy(s+1, s+4);
+               UtilStrCpy(s+1, s+4);
             } else {
                sprintf(gszMsgBox,
                      TgLoadString(STID_BAD_OCTAL_STRING_ENCOUNTERED),
@@ -2047,10 +2047,10 @@
                } else {
                   Msg(gszMsgBox);
                }
-               strcpy(s, s+1);
+               UtilStrCpy(s, s+1);
             }
          } else {
-            strcpy(s, s+1);
+            UtilStrCpy(s, s+1);
          }
       }
    }
--- a/names.c
+++ b/names.c
@@ -115,7 +115,7 @@
    }
    for ( ; *s1 != '\0' && *s1 != ':'; s1++) {
       if (*s1 == '\\') {
-         strcpy(s1, s1+1);
+         UtilStrCpy(s1, s1+1);
       } else {
          *s2++ = *s1;
       }
--- a/util.c
+++ b/util.c
@@ -76,6 +76,19 @@
    return len;
 }
 
+int UtilStrCpy(pszDest, pszSrc)
+   char *pszDest, *pszSrc;
+{
+   int len=0;
+
+   if (pszDest == NULL || pszSrc == NULL) return 0;
+
+   while (((*pszDest++)=(*pszSrc++)) != '\0') {
+      len++;
+   }
+   return len;
+}
+
 void UtilLeftTrim(pszStr)
    char *pszStr;
    /* pszStr must be terminated by '\0' */
--- a/util.e
+++ b/util.e
@@ -31,6 +31,7 @@
 extern char	*UtilStrDup ARGS_DECL((char *pszStr));
 extern int	UtilStrCpyN ARGS_DECL((char *pszDest, int nMaxDestSz,
 				char *pszSrc));
+extern int	UtilStrCpy ARGS_DECL((char *pszDest, char *pszSrc));
 extern void	UtilLeftTrim ARGS_DECL((char *pszStr));
 extern void	UtilRightTrim ARGS_DECL((char *pszStr));
 extern void	UtilTrimBlanks ARGS_DECL((char *pszStr));
