Code

Fix strfsong behaviour for unknown identifier
authorLars-Dominik Braun <lars@6xq.net>
Tue, 12 Jun 2012 21:15:44 +0000 (23:15 +0200)
committerJonathan Neuschäfer <j.neuschaefer@gmx.net>
Tue, 12 Jun 2012 21:15:44 +0000 (23:15 +0200)
[jn: adjusted the white space style]

src/strfsong.c

index 3d5abd5797dfd78e50e9515f72763efabf5ee7cc..e3d4eb98cda560fd56d291bee98ff18207f56499 100644 (file)
@@ -243,12 +243,12 @@ _strfsong(gchar *s,
                if( temp == NULL) {
                        gsize templen=n;
                        /* just pass-through any unknown specifiers (including esc) */
-                       /* drop a null char in so printf stops at the end of this specifier,
-                          but put the real character back in (pseudo-const) */
                        if( length+templen > max )
                                templen = max-length;
-                       g_strlcat(s, p,max);
+                       gchar *ident = g_strndup(p, templen);
+                       g_strlcat(s, ident, max);
                        length+=templen;
+                       g_free(ident);
                } else {
                        gsize templen = strlen(temp);