mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-09 02:52:04 +08:00
LDAPworld P10: SLAPD Index corruption
This commit is contained in:
parent
221db1f19a
commit
38c92a1151
@ -3,7 +3,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include "slap.h"
|
||||
#include "back-ldbm.h"
|
||||
|
||||
@ -130,25 +129,26 @@ index_read(
|
||||
realval = val;
|
||||
tmpval = NULL;
|
||||
if ( prefix != '\0' ) {
|
||||
int len;
|
||||
int len = strlen( val );
|
||||
|
||||
if ( (len = strlen( val )) < sizeof(buf) ) {
|
||||
buf[0] = prefix;
|
||||
strcpy( &buf[1], val );
|
||||
if ( (len + 2) < sizeof(buf) ) {
|
||||
realval = buf;
|
||||
} else {
|
||||
/* value + prefix + null */
|
||||
tmpval = (char *) ch_malloc( len + 2 );
|
||||
tmpval[0] = prefix;
|
||||
strcat( &tmpval[1], val );
|
||||
realval = tmpval;
|
||||
}
|
||||
realval[0] = prefix;
|
||||
strcpy( &realval[1], val );
|
||||
}
|
||||
|
||||
key.dptr = realval;
|
||||
key.dsize = strlen( realval ) + 1;
|
||||
|
||||
idl = idl_fetch( be, db, key );
|
||||
if ( tmpval != NULL ) {
|
||||
free( tmpval );
|
||||
}
|
||||
|
||||
ldbm_cache_close( be, db );
|
||||
|
||||
@ -181,19 +181,17 @@ add_value(
|
||||
tmpval = NULL;
|
||||
idl = NULL;
|
||||
if ( prefix != '\0' ) {
|
||||
int len;
|
||||
int len = strlen( val );
|
||||
|
||||
if ( (len = strlen( val )) < sizeof(buf) ) {
|
||||
buf[0] = prefix;
|
||||
strcpy( &buf[1], val );
|
||||
if ( (len + 2) < sizeof(buf) ) {
|
||||
realval = buf;
|
||||
} else {
|
||||
/* value + prefix + null */
|
||||
tmpval = (char *) ch_malloc( len + 2 );
|
||||
tmpval[0] = prefix;
|
||||
strcat( &tmpval[1], val );
|
||||
realval = tmpval;
|
||||
}
|
||||
realval[0] = prefix;
|
||||
strcpy( &realval[1], val );
|
||||
}
|
||||
|
||||
key.dptr = realval;
|
||||
|
Loading…
Reference in New Issue
Block a user