From 9cc32ac874d47b6edab0862effb8b6a9d1576a8f Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Fri, 27 Feb 2004 09:32:16 +0000 Subject: [PATCH] Fix crasher if paged results size is not specified --- clients/tools/ldapsearch.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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; -- 2.39.5