Increased maximum path length from 180 to 255, and replaced sprintf with snprintf to prevent buffer overflow.
This commit is contained in:
@ -57,15 +57,18 @@ int i;
|
|||||||
static MAXKEYS *
|
static MAXKEYS *
|
||||||
secrets_readKeys()
|
secrets_readKeys()
|
||||||
{
|
{
|
||||||
char secret_file[180];
|
char secret_file[255];
|
||||||
char *home;
|
char *home;
|
||||||
MAXKEYS *keys;
|
MAXKEYS *keys;
|
||||||
struct stat secret_stats;
|
struct stat secret_stats;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if ((home = getenv("MAXSCALE_HOME")) == NULL)
|
home = getenv("MAXSCALE_HOME");
|
||||||
home = "/usr/local/skysql/MaxScale";
|
|
||||||
sprintf(secret_file, "%s/etc/.secrets", home);
|
if (home == NULL) {
|
||||||
|
home = "/usr/local/skysql/MaxScale";
|
||||||
|
}
|
||||||
|
snprintf(secret_file, 255, "%s/etc/.secrets", home);
|
||||||
|
|
||||||
/* Silently check for a .secrets file */
|
/* Silently check for a .secrets file */
|
||||||
if (access(secret_file, R_OK) == -1)
|
if (access(secret_file, R_OK) == -1)
|
||||||
|
|||||||
Reference in New Issue
Block a user