Increased maximum path length from 180 to 255, and replaced sprintf with snprintf to prevent buffer overflow.

This commit is contained in:
vraatikka 2013-08-23 22:27:40 +03:00
parent 68a5a389ee
commit c9ff06e0f5

View File

@ -57,15 +57,18 @@ int i;
static MAXKEYS *
secrets_readKeys()
{
char secret_file[180];
char secret_file[255];
char *home;
MAXKEYS *keys;
struct stat secret_stats;
int fd;
if ((home = getenv("MAXSCALE_HOME")) == NULL)
home = "/usr/local/skysql/MaxScale";
sprintf(secret_file, "%s/etc/.secrets", home);
home = getenv("MAXSCALE_HOME");
if (home == NULL) {
home = "/usr/local/skysql/MaxScale";
}
snprintf(secret_file, 255, "%s/etc/.secrets", home);
/* Silently check for a .secrets file */
if (access(secret_file, R_OK) == -1)