diff options
Diffstat (limited to 'libpiano/src/xml.c')
-rw-r--r-- | libpiano/src/xml.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libpiano/src/xml.c b/libpiano/src/xml.c index 30f4c2e..c0d388f 100644 --- a/libpiano/src/xml.c +++ b/libpiano/src/xml.c @@ -617,7 +617,8 @@ char *PianoXmlEncodeString (const char *s) { char *replacements[] = {"&&", "''", "\""", "<<", ">>", NULL}; char **r; - char *sOut = calloc (strlen (s) * 5 + 1, sizeof (*sOut)); + char *sOut = calloc (strlen (s) * 5 + 1, sizeof (*sOut)), + *sOutCurr = sOut; char found; while (*s != '\0') { @@ -626,13 +627,15 @@ char *PianoXmlEncodeString (const char *s) { while (*r != NULL) { if (*s == *r[0]) { found = 1; - strcat (sOut, (*r) + 1); + strcat (sOutCurr, (*r) + 1); + sOutCurr += strlen ((*r) + 1); break; } r++; } if (!found) { - strncat (sOut, s, 1); + *sOutCurr = *s; + sOutCurr++; } s++; } |