mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-18 11:05:48 +08:00
Initialization of Datum structures to zero by memset() before first use.
If Berkeley DB version 2.x is used as a slapd back-end a not-initialized Datum structure will raise an EINVAL error in (DB)->put().
This commit is contained in:
parent
8854adfc49
commit
9e97da14fb
@ -473,6 +473,8 @@ generate_new_centroids(
|
||||
char **val;
|
||||
char last;
|
||||
|
||||
memset( &data, 0 , sizeof( data ));
|
||||
|
||||
if ( verbose ) {
|
||||
printf( "Generating new centroids for..." );
|
||||
fflush( stdout );
|
||||
@ -495,6 +497,9 @@ generate_new_centroids(
|
||||
|
||||
/* for each value */
|
||||
for ( j = 0; val[j] != NULL; j++ ) {
|
||||
|
||||
memset( &key, 0 , sizeof( key ));
|
||||
|
||||
/* normalize the value */
|
||||
for ( s = val[j]; *s; s++ ) {
|
||||
if ( isascii( *s ) ) {
|
||||
@ -570,6 +575,14 @@ diff_centroids(
|
||||
fflush( stdout );
|
||||
}
|
||||
|
||||
memset( &okey, 0, sizeof( okey ));
|
||||
memset( &nkey, 0, sizeof( nkey ));
|
||||
memset( &olast, 0, sizeof( olast ));
|
||||
memset( &nlast, 0, sizeof( nlast ));
|
||||
memset( &lastkey, 0, sizeof( lastkey ));
|
||||
memset( &key, 0, sizeof( key ));
|
||||
memset( &data, 0, sizeof( data ));
|
||||
|
||||
if ( (mods = (LDAPMod **) malloc( sizeof(LDAPMod *) * 4 )) == NULL ||
|
||||
(mods[0] = (LDAPMod *) malloc( sizeof(LDAPMod) )) == NULL ||
|
||||
(mods[1] = (LDAPMod *) malloc( sizeof(LDAPMod) )) == NULL ||
|
||||
@ -832,6 +845,9 @@ full_centroid(
|
||||
fflush( stdout );
|
||||
}
|
||||
|
||||
memset( &key, 0, sizeof( key ));
|
||||
memset( &lastkey, 0, sizeof( lastkey ));
|
||||
|
||||
if ( (mods = (LDAPMod **) malloc( sizeof(LDAPMod *) * 3 )) == NULL ||
|
||||
(mods[0] = (LDAPMod *) malloc( sizeof(LDAPMod) )) == NULL ||
|
||||
(mods[1] = (LDAPMod *) malloc( sizeof(LDAPMod) )) == NULL ||
|
||||
|
@ -28,6 +28,10 @@ main( int argc, char **argv )
|
||||
|
||||
#ifdef HAVE_BERKELEY_DB2
|
||||
DBC *cursorp;
|
||||
|
||||
memset( &key, 0, sizeof( key ));
|
||||
memset( &last, 0, sizeof( last ));
|
||||
memset( &data, 0, sizeof( data ));
|
||||
#endif
|
||||
|
||||
if ( argc < 2 || argc > 3 || ( argc == 3 && strcmp( argv[1], "-n" )
|
||||
|
@ -68,6 +68,11 @@ main( int argc, char **argv )
|
||||
|
||||
#ifdef HAVE_BERKELEY_DB2
|
||||
DBC *cursorp;
|
||||
|
||||
memset( &savekey, 0, sizeof( savekey ));
|
||||
memset( &key, 0, sizeof( key ));
|
||||
memset( &data, 0, sizeof( data ));
|
||||
memset( &last, 0, sizeof( last ));
|
||||
#endif
|
||||
|
||||
tailorfile = SLAPD_DEFAULT_CONFIGFILE;
|
||||
|
@ -149,6 +149,9 @@ main( int argc, char **argv )
|
||||
int vlen;
|
||||
Datum key, data;
|
||||
|
||||
memset( &key, 0, sizeof( key ));
|
||||
memset( &data, 0, sizeof( data ));
|
||||
|
||||
if ( fgets( line, sizeof(line), stdin ) != NULL ) {
|
||||
int len;
|
||||
|
||||
@ -232,6 +235,9 @@ main( int argc, char **argv )
|
||||
char buf2[20];
|
||||
Datum key, data;
|
||||
|
||||
memset( &key, 0, sizeof( key ));
|
||||
memset( &data, 0, sizeof( data ));
|
||||
|
||||
if ( fgets( line, sizeof(line), stdin ) != NULL ) {
|
||||
int len;
|
||||
|
||||
|
@ -141,6 +141,9 @@ main( int argc, char **argv )
|
||||
int vlen;
|
||||
Datum key, data;
|
||||
|
||||
memset( &key, 0, sizeof( key ));
|
||||
memset( &data, 0, sizeof( data ));
|
||||
|
||||
if ( fgets( line, sizeof(line), stdin ) != NULL ) {
|
||||
int len, idlen;
|
||||
|
||||
|
@ -224,6 +224,9 @@ main( int argc, char **argv )
|
||||
int vlen, indexmask, syntaxmask;
|
||||
Datum key, data;
|
||||
|
||||
memset( &key, 0, sizeof( key ));
|
||||
memset( &data, 0, sizeof( data ));
|
||||
|
||||
if ( fgets( line, sizeof(line), stdin ) != NULL ) {
|
||||
int len;
|
||||
|
||||
|
@ -94,6 +94,9 @@ main( int argc, char **argv )
|
||||
Datum key, data;
|
||||
char *w;
|
||||
|
||||
memset( &key, 0, sizeof( key ));
|
||||
memset( &data, 0, sizeof( data ));
|
||||
|
||||
/* update value count */
|
||||
vcount++;
|
||||
vsize += bvals[j]->bv_len;
|
||||
@ -176,6 +179,9 @@ add(
|
||||
{
|
||||
Datum key, data;
|
||||
|
||||
memset( &key, 0, sizeof( key ));
|
||||
memset( &data, 0, sizeof( data ));
|
||||
|
||||
key.dptr = s;
|
||||
key.dsize = strlen( key.dptr ) + 1;
|
||||
data.dptr = "";
|
||||
|
Loading…
Reference in New Issue
Block a user