[Fedora-directory-commits] ldapserver/ldap/servers/snmp main.c, 1.11, 1.12

Nathan Kinder (nkinder) fedora-directory-commits at redhat.com
Mon Oct 15 19:19:35 UTC 2007


Author: nkinder

Update of /cvs/dirsec/ldapserver/ldap/servers/snmp
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv28340

Modified Files:
	main.c 
Log Message:
Resolves: 328741
Summary: Ensure that we NULL terminate strings properly when processing config file settings.



Index: main.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/snmp/main.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- main.c	8 Aug 2007 16:50:00 -0000	1.11
+++ main.c	15 Oct 2007 19:19:32 -0000	1.12
@@ -264,6 +264,10 @@
             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 {




More information about the Fedora-directory-commits mailing list