1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-09-13 22:52:09 +00:00

Merge pull request #116 from holymonson/master

fix strcpy NULL pointer if env HOME unset.
This commit is contained in:
Con Kolivas 2012-02-14 05:32:53 -08:00
commit 8798a904c6

View File

@ -929,9 +929,10 @@ static void load_default_config(void)
char buf[PATH_MAX]; char buf[PATH_MAX];
#if defined(unix) #if defined(unix)
if (getenv("HOME") && *getenv("HOME")) {
strcpy(buf, getenv("HOME")); strcpy(buf, getenv("HOME"));
if (*buf)
strcat(buf, "/"); strcat(buf, "/");
}
else else
strcpy(buf, ""); strcpy(buf, "");
strcat(buf, ".cgminer/"); strcat(buf, ".cgminer/");
@ -2640,9 +2641,10 @@ retry:
char *str, filename[PATH_MAX], prompt[PATH_MAX + 50]; char *str, filename[PATH_MAX], prompt[PATH_MAX + 50];
#if defined(unix) #if defined(unix)
if (getenv("HOME") && *getenv("HOME")) {
strcpy(filename, getenv("HOME")); strcpy(filename, getenv("HOME"));
if (*filename)
strcat(filename, "/"); strcat(filename, "/");
}
else else
strcpy(filename, ""); strcpy(filename, "");
strcat(filename, ".cgminer/"); strcat(filename, ".cgminer/");