summaryrefslogtreecommitdiffstats
path: root/ldap/servers/snmp
diff options
context:
space:
mode:
authorNathan Kinder <nkinder@redhat.com>2007-10-15 19:19:32 +0000
committerNathan Kinder <nkinder@redhat.com>2007-10-15 19:19:32 +0000
commit6e0b12928e32a715d2dddac5f72cb8adeaf721a2 (patch)
tree253d204e6e176d5f7db46390293e3a5ee2389a39 /ldap/servers/snmp
parent30d06808425c4962e0913b535473c0a0d557ff14 (diff)
downloadds-6e0b12928e32a715d2dddac5f72cb8adeaf721a2.tar.gz
ds-6e0b12928e32a715d2dddac5f72cb8adeaf721a2.tar.xz
ds-6e0b12928e32a715d2dddac5f72cb8adeaf721a2.zip
Resolves: 328741
Summary: Ensure that we NULL terminate strings properly when processing config file settings.
Diffstat (limited to 'ldap/servers/snmp')
-rw-r--r--ldap/servers/snmp/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ldap/servers/snmp/main.c b/ldap/servers/snmp/main.c
index bd76e1d8..6648776e 100644
--- a/ldap/servers/snmp/main.c
+++ b/ldap/servers/snmp/main.c
@@ -264,6 +264,10 @@ load_config(char *conf_path)
if ((pidfile = malloc((p - conf_path) +
strlen(LDAP_AGENT_PIDFILE) + 2)) != NULL) {
strncpy(pidfile, conf_path, (p - conf_path + 1));
+ /* The above will likely not be NULL terminated, but we need to
+ * be sure that we're properly NULL terminated for the below
+ * strcat() to work properly. */
+ pidfile[(p - conf_path + 2)] = (char)0;
strcat(pidfile, LDAP_AGENT_PIDFILE);
pidfile[((p - conf_path) + strlen(LDAP_AGENT_PIDFILE) + 1)] = (char)0;
} else {