mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 10:04:33 +00:00
fix strcpy NULL pointer if env HOME unset.
This commit is contained in:
parent
aa1523d765
commit
8047af5af4
10
cgminer.c
10
cgminer.c
@ -929,9 +929,10 @@ static void load_default_config(void)
|
|||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
#if defined(unix)
|
#if defined(unix)
|
||||||
strcpy(buf, getenv("HOME"));
|
if (getenv("HOME") && *getenv("HOME")) {
|
||||||
if (*buf)
|
strcpy(buf, getenv("HOME"));
|
||||||
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)
|
||||||
strcpy(filename, getenv("HOME"));
|
if (getenv("HOME") && *getenv("HOME")) {
|
||||||
if (*filename)
|
strcpy(filename, getenv("HOME"));
|
||||||
strcat(filename, "/");
|
strcat(filename, "/");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
strcpy(filename, "");
|
strcpy(filename, "");
|
||||||
strcat(filename, ".cgminer/");
|
strcat(filename, ".cgminer/");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user