From: Thierry Lorthiois Date: Sun, 15 Aug 2010 02:24:13 +0000 (+0000) Subject: launcher: Prevent calling strlen on NULL X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=0a5cac5363c866290790479299b7713e79deb27b;p=chaz%2Ftint2 launcher: Prevent calling strlen on NULL --- diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index 6418a4c..c90c545 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -372,7 +372,7 @@ void expand_exec(DesktopEntry *entry, const char *path) // %c -> Name // %k -> path if (entry->exec) { - char *exec2 = malloc(strlen(entry->exec) + strlen(entry->name) + strlen(entry->icon) + 100); + char *exec2 = malloc(strlen(entry->exec) + (entry->name ? strlen(entry->name) : 1) + (entry->icon ? strlen(entry->icon) : 1) + 100); char *p, *q; // p will never point to an escaped char for (p = entry->exec, q = exec2; *p; p++, q++) {