Commit eb8d2024 authored by Rafaël Carré's avatar Rafaël Carré

config_GetTypeDir() : don't call strlen(NULL) if HOME is not set

parent 077b53f1
...@@ -117,7 +117,6 @@ static char *config_GetTypeDir (const char *xdg_name) ...@@ -117,7 +117,6 @@ static char *config_GetTypeDir (const char *xdg_name)
{ {
const size_t namelen = strlen (xdg_name); const size_t namelen = strlen (xdg_name);
const char *home = getenv ("HOME"); const char *home = getenv ("HOME");
const size_t homelen = strlen (home);
const char *dir = getenv ("XDG_CONFIG_HOME"); const char *dir = getenv ("XDG_CONFIG_HOME");
const char *file = "user-dirs.dirs"; const char *file = "user-dirs.dirs";
...@@ -174,6 +173,7 @@ static char *config_GetTypeDir (const char *xdg_name) ...@@ -174,6 +173,7 @@ static char *config_GetTypeDir (const char *xdg_name)
} }
else else
{ /* Prefix with $HOME */ { /* Prefix with $HOME */
const size_t homelen = strlen (home);
ptr += 5; ptr += 5;
path = malloc (homelen + linelen - 5); path = malloc (homelen + linelen - 5);
if (path == NULL) if (path == NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment