diff --git a/src/confparser.c b/src/confparser.c index b7353bf..3a576e4 100644 --- a/src/confparser.c +++ b/src/confparser.c @@ -338,7 +338,7 @@ static int test_conf_syntax(void) } else strncpy(conf.rmps.agent_tls_crt, tmp + 1, - sizeof(conf.rmps.agent_tls_crt)); + sizeof(conf.rmps.agent_tls_crt) - 1); } else if (!strcmp(buf, "rmps.agent_tls_key")) { if (access(tmp + 1, F_OK) == -1) { log(ERROR, "%s is missing", tmp + 1); @@ -349,10 +349,10 @@ static int test_conf_syntax(void) } else strncpy(conf.rmps.agent_tls_key, tmp + 1, - sizeof(conf.rmps.agent_tls_key)); + sizeof(conf.rmps.agent_tls_key) - 1); } else if (!strcmp(buf, "rmps.cipherlist")) { strncpy(conf.rmps.cipherlist, - tmp + 1, sizeof(conf.rmps.cipherlist)); + tmp + 1, sizeof(conf.rmps.cipherlist) - 1); } else if (!strcmp(buf, "rmps.cafile")) { if (access(tmp + 1, F_OK) == -1) { log(ERROR, "%s is missing", tmp + 1); @@ -362,7 +362,7 @@ static int test_conf_syntax(void) failed = 1; } else strncpy(conf.rmps.cafile, - tmp + 1, sizeof(conf.rmps.cafile)); + tmp + 1, sizeof(conf.rmps.cafile) - 1); } else if (!strcmp(buf, "rmps.client_tls_crt")) { if (access(tmp + 1, F_OK) == -1) { log(ERROR, "%s is missing", tmp + 1); @@ -373,7 +373,7 @@ static int test_conf_syntax(void) } else strncpy(conf.rmps.client_tls_crt, tmp + 1, - sizeof(conf.rmps.client_tls_crt)); + sizeof(conf.rmps.client_tls_crt) - 1); } else if (!strcmp(buf, "rmps.client_tls_key")) { if (access(tmp + 1, F_OK) == -1) { log(ERROR, "%s is missing", tmp + 1); @@ -384,7 +384,7 @@ static int test_conf_syntax(void) } else strncpy(conf.rmps.client_tls_key, tmp + 1, - sizeof(conf.rmps.client_tls_key)); + sizeof(conf.rmps.client_tls_key) - 1); } else log(ERROR, "Unknown config entry on line %d: %s", j, buf);