Fix for missing leading /

Fix for missing leading /
This commit is contained in:
MassimilianoPinto
2015-08-26 11:13:27 +02:00
parent 46e9e41433
commit 5f328bfcf9

View File

@ -84,7 +84,7 @@ int main(int argc, char **argv) {
int fd; int fd;
int ret; int ret;
char *ptr; char *ptr;
char path[4097] = ""; char path[PATH_MAX+1] = "";
unsigned long filelen = 0; unsigned long filelen = 0;
struct stat statb; struct stat statb;
char c; char c;
@ -152,7 +152,7 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
strncpy(path, argv[num_args], 4096); strncpy(path, argv[num_args], PATH_MAX);
if ((fd = open(path, O_RDONLY, 0666)) == -1) if ((fd = open(path, O_RDONLY, 0666)) == -1)
{ {
@ -172,7 +172,9 @@ int main(int argc, char **argv) {
ptr = strrchr(path, '/'); ptr = strrchr(path, '/');
if (ptr) if (ptr)
strncpy(inst->binlog_name, ptr+1, 16); strncpy(inst->binlog_name, ptr+1, BINLOG_FNAMELEN);
else
strncpy(inst->binlog_name, ptr, BINLOG_FNAMELEN);
LOGIF(LM, (skygw_log_write_flush(LOGFILE_MESSAGE, LOGIF(LM, (skygw_log_write_flush(LOGFILE_MESSAGE,
"maxbinlogcheck %s", binlog_check_version))); "maxbinlogcheck %s", binlog_check_version)));