Commit fde1f80a authored by Ondrej Kuznik's avatar Ondrej Kuznik Committed by Howard Chu
Browse files

ITS#7256 Add some necessary checks.

parent 304c0cbb
...@@ -282,7 +282,8 @@ slapmodify( int argc, char **argv ) ...@@ -282,7 +282,8 @@ slapmodify( int argc, char **argv )
e = e_tmp; e = e_tmp;
} }
for ( n = 0; lr.lrop_mods[ n ] != NULL; n++ ) { if ( lr.lrop_mods ) {
for ( n = 0; lr.lrop_mods && lr.lrop_mods[ n ] != NULL; n++ ) {
LDAPMod *mod = lr.lrop_mods[ n ]; LDAPMod *mod = lr.lrop_mods[ n ];
Modification mods = { 0 }; Modification mods = { 0 };
unsigned i = 0; unsigned i = 0;
...@@ -327,12 +328,15 @@ slapmodify( int argc, char **argv ) ...@@ -327,12 +328,15 @@ slapmodify( int argc, char **argv )
; ;
} }
if ( i != 0 )
{
mods.sm_values = SLAP_CALLOC( sizeof( struct berval ), i + 1 ); mods.sm_values = SLAP_CALLOC( sizeof( struct berval ), i + 1 );
if ( normalize ) { if ( normalize ) {
mods.sm_nvalues = SLAP_CALLOC( sizeof( struct berval ), i + 1 ); mods.sm_nvalues = SLAP_CALLOC( sizeof( struct berval ), i + 1 );
} else { } else {
mods.sm_nvalues = NULL; mods.sm_nvalues = NULL;
} }
}
mods.sm_numvals = i; mods.sm_numvals = i;
for ( i = 0; i < mods.sm_numvals; i++ ) { for ( i = 0; i < mods.sm_numvals; i++ ) {
...@@ -449,6 +453,7 @@ slapmodify( int argc, char **argv ) ...@@ -449,6 +453,7 @@ slapmodify( int argc, char **argv )
entry_free( e ); entry_free( e );
break; break;
} }
}
if ( SLAP_LASTMOD(be) ) { if ( SLAP_LASTMOD(be) ) {
time_t now = slap_get_time(); time_t now = slap_get_time();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment