From: Luke Howard Date: Fri, 27 Feb 2004 09:32:16 +0000 (+0000) Subject: Fix crasher if paged results size is not specified X-Git-Tag: OPENLDAP_REL_ENG_2_2_BP~398 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9cc32ac874d47b6edab0862effb8b6a9d1576a8f;p=openldap Fix crasher if paged results size is not specified --- diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 7d9a453baf..c5357c95a0 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -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;