From: Lars-Dominik Braun Date: Tue, 12 Jun 2012 21:15:44 +0000 (+0200) Subject: Fix strfsong behaviour for unknown identifier X-Git-Tag: release-0.21~22 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8dc7f960157a7132575f37989dc5e5def893f7d0;p=ncmpc.git Fix strfsong behaviour for unknown identifier [jn: adjusted the white space style] --- diff --git a/src/strfsong.c b/src/strfsong.c index 3d5abd5..e3d4eb9 100644 --- a/src/strfsong.c +++ b/src/strfsong.c @@ -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);