From 89e4a5a4609e85ae406cee14affdfbf3283429aa Mon Sep 17 00:00:00 2001 From: o9000 Date: Sat, 4 Jul 2015 18:31:01 +0200 Subject: [PATCH] Fix crash in tint2conf (wrong string length in allocation) --- src/util/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/common.c b/src/util/common.c index 67227ea..62f88c2 100644 --- a/src/util/common.c +++ b/src/util/common.c @@ -117,13 +117,13 @@ char *contract_tilde(char *s) if (!home) return strdup(s); - char *home_slash = calloc(strlen(home) + 1, 1); + char *home_slash = calloc(strlen(home) + 2, 1); strcat(home_slash, home); strcat(home_slash, "/"); if ((strcmp(s, home) == 0 || strstr(s, home_slash) == s)) { - char *result = calloc(strlen(s) - strlen(home) + 1, 1); + char *result = calloc(strlen(s) - strlen(home) + 2, 1); strcat(result, "~"); strcat(result, s + strlen(home)); free(home_slash);