Fix crasher if paged results size is not specified

This commit is contained in:
Luke Howard 2004-02-27 09:32:16 +00:00
parent bd8712ad36
commit 9cc32ac874

View File

@ -302,12 +302,16 @@ handle_private_option( int i )
fprintf( stderr, _("PagedResultsControl previously specified\n") );
exit( EXIT_FAILURE );
}
num = sscanf( cvalue, "%d", &tmp );
if ( num != 1 ) {
fprintf( stderr, _("Invalid value for PagedResultsControl, %s.\n"), cvalue);
exit( EXIT_FAILURE );
if( cvalue != NULL ) {
num = sscanf( cvalue, "%d", &tmp );
if ( num != 1 ) {
fprintf( stderr, _("Invalid value for PagedResultsControl, %s.\n"), cvalue);
exit( EXIT_FAILURE );
}
} else {
fprintf( stderr, _("Invalid value for PagedResultsControl.\n"), cvalue);
exit( EXIT_FAILURE );
}
pageSize = (ber_int_t) tmp;
pagedResults = 1 + crit;