From: Kurt Zeilenga Date: Wed, 25 Sep 2002 04:34:33 +0000 (+0000) Subject: benign buffer overflow fix (ITS#1964) X-Git-Tag: NO_SLAP_OP_BLOCKS~940 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b4e1ea15f3081a065318f5ee99336494c8765bca;p=openldap benign buffer overflow fix (ITS#1964) --- diff --git a/servers/slapd/at.c b/servers/slapd/at.c index 238b91f684..5b59674b5e 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -338,7 +338,6 @@ at_add( ldap_memfree( at->at_syntax_oid ); at->at_syntax_oid = oid; } - } if ( at->at_names && at->at_names[0] ) { diff --git a/servers/slapd/lock.c b/servers/slapd/lock.c index fb5c5bb715..79017f23a0 100644 --- a/servers/slapd/lock.c +++ b/servers/slapd/lock.c @@ -28,7 +28,8 @@ lock_fopen( const char *fname, const char *type, FILE **lfp ) char buf[MAXPATHLEN]; /* open the lock file */ - strcpy(lutil_strcopy( buf, fname ), ".lock" ); + snprintf( buf, sizeof buf, "%s.lock", fname ); + if ( (*lfp = fopen( buf, "w" )) == NULL ) { #ifdef NEW_LOGGING LDAP_LOG( OPERATION, ERR, diff --git a/servers/slurpd/lock.c b/servers/slurpd/lock.c index ce6fffb031..5b707942e6 100644 --- a/servers/slurpd/lock.c +++ b/servers/slurpd/lock.c @@ -47,8 +47,8 @@ lock_fopen( char buf[MAXPATHLEN]; /* open the lock file */ - strcpy( buf, fname ); - strcat( buf, ".lock" ); + snprintf( buf, sizeof buf, "%s.lock", fname ); + if ( (*lfp = fopen( buf, "w" )) == NULL ) { #ifdef NEW_LOGGING LDAP_LOG ( SLURPD, ERR, "lock_fopen: "