mirror of
https://github.com/GOSTSec/sgminer
synced 2025-03-10 04:31:03 +00:00
Merge pull request #116 from holymonson/master
fix strcpy NULL pointer if env HOME unset.
This commit is contained in:
commit
8798a904c6
10
cgminer.c
10
cgminer.c
@ -929,9 +929,10 @@ static void load_default_config(void)
|
||||
char buf[PATH_MAX];
|
||||
|
||||
#if defined(unix)
|
||||
strcpy(buf, getenv("HOME"));
|
||||
if (*buf)
|
||||
if (getenv("HOME") && *getenv("HOME")) {
|
||||
strcpy(buf, getenv("HOME"));
|
||||
strcat(buf, "/");
|
||||
}
|
||||
else
|
||||
strcpy(buf, "");
|
||||
strcat(buf, ".cgminer/");
|
||||
@ -2640,9 +2641,10 @@ retry:
|
||||
char *str, filename[PATH_MAX], prompt[PATH_MAX + 50];
|
||||
|
||||
#if defined(unix)
|
||||
strcpy(filename, getenv("HOME"));
|
||||
if (*filename)
|
||||
if (getenv("HOME") && *getenv("HOME")) {
|
||||
strcpy(filename, getenv("HOME"));
|
||||
strcat(filename, "/");
|
||||
}
|
||||
else
|
||||
strcpy(filename, "");
|
||||
strcat(filename, ".cgminer/");
|
||||
|
Loading…
x
Reference in New Issue
Block a user