TMXR: avoid calling strcpy with overlapping arguments

This commit is contained in:
Mark Pizzolato 2014-03-11 19:30:28 -07:00
parent 93b68432f2
commit 194b35f6e8

View file

@ -831,7 +831,7 @@ if (mp->buffered)
if (mp->logfiletmpl[0]) /* logfile info */ if (mp->logfiletmpl[0]) /* logfile info */
sprintf (growstring(&tptr, 7 + strlen (mp->logfiletmpl)), ",Log=%s", mp->logfiletmpl); sprintf (growstring(&tptr, 7 + strlen (mp->logfiletmpl)), ",Log=%s", mp->logfiletmpl);
while ((*tptr == ',') || (*tptr == ' ')) while ((*tptr == ',') || (*tptr == ' '))
strcpy(tptr, tptr+1); memcpy (tptr, tptr+1, strlen(tptr+1)+1);
for (i=0; i<mp->lines; ++i) { for (i=0; i<mp->lines; ++i) {
char *lptr; char *lptr;
lp = mp->ldsc + i; lp = mp->ldsc + i;
@ -844,7 +844,7 @@ for (i=0; i<mp->lines; ++i) {
} }
if (mp->lines == 1) if (mp->lines == 1)
while ((*tptr == ',') || (*tptr == ' ')) while ((*tptr == ',') || (*tptr == ' '))
strcpy(tptr, tptr+1); memcpy (tptr, tptr+1, strlen(tptr+1)+1);
if (*tptr == '\0') { if (*tptr == '\0') {
free (tptr); free (tptr);
tptr = NULL; tptr = NULL;