Fixes to Coverity defects 85010 84878 72752 72742 72719 and 73418.

skygw_utils.cc: Added function is_valid_posix_path that checks if a path is POSIX-compliant.
This commit is contained in:
Markus Makela
2015-01-05 06:05:56 +02:00
parent b3d79f7273
commit ba009e5fd3
9 changed files with 36 additions and 16 deletions

View File

@ -272,6 +272,8 @@ char *home, buf[1024];
if ((home = getenv("MAXSCALE_HOME")) == NULL || strlen(home) >= 1024)
home = "/usr/local/skysql";
sprintf(buf, "%s/etc/passwd", home);
if(!is_valid_posix_path(buf))
exit(1);
if (strcmp(buf, "/etc/passwd") != 0)
unlink(buf);