From 9774f23bf78a6e6d3ae4cfe3d73bad34f2fdcd17 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Mon, 27 Jul 2020 09:25:09 +0200 Subject: [PATCH] Fix https://github.com/vgropp/bwm-ng/issues/26 --- src/options.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/options.c b/src/options.c index 78e1c2d..c3610c3 100644 --- a/src/options.c +++ b/src/options.c @@ -335,6 +335,10 @@ void get_cmdln_options(int argc, char *argv[]) { pwd_entry=getpwuid(getuid()); if (pwd_entry!=NULL) { str=(char*)malloc(strlen(pwd_entry->pw_dir)+14); + if(!str) { + printf("Fatal: failed to allocate %zu bytes.\n", strlen(pwd_entry->pw_dir)+14); + exit(EXIT_FAILURE); + } snprintf(str,strlen(pwd_entry->pw_dir)+14,"%s/.bwm-ng.conf",pwd_entry->pw_dir); read_config(str); free(str);