chiark / gitweb /
specifier: properly size newly allocated string
authorLennart Poettering <lennart@poettering.net>
Fri, 30 Apr 2010 00:16:22 +0000 (02:16 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 30 Apr 2010 00:16:22 +0000 (02:16 +0200)
specifier.c

index a25f33a..d8472e9 100644 (file)
@@ -70,7 +70,7 @@ char *specifier_printf(const char *text, const Specifier table[], void *userdata
                                         j = t - r;
                                         k = strlen(w);
 
-                                        if (!(n = new(char, j + k + (l - (f - text)) + 1))) {
+                                        if (!(n = new(char, j + k + l + 1))) {
                                                 free(r);
                                                 free(w);
                                                 return NULL;