@ -4193,7 +4193,7 @@ static unsigned int dundi_result_id;
struct dundi_result_datastore {
struct dundi_result_datastore {
struct dundi_result results [ MAX_RESULTS ] ;
struct dundi_result results [ MAX_RESULTS ] ;
unsigned int num_results ;
int num_results ;
unsigned int id ;
unsigned int id ;
} ;
} ;
@ -4325,7 +4325,7 @@ static int dundi_result_read(struct ast_channel *chan, const char *cmd, char *da
drds = datastore - > data ;
drds = datastore - > data ;
if ( ! strcasecmp ( args . resultnum , " getnum " ) ) {
if ( ! strcasecmp ( args . resultnum , " getnum " ) ) {
snprintf ( buf , len , " % u" , drds - > num_results ) ;
snprintf ( buf , len , " % d" , drds - > num_results < 0 ? 0 : drds - > num_results ) ;
res = 0 ;
res = 0 ;
goto finish ;
goto finish ;
}
}
@ -4336,7 +4336,7 @@ static int dundi_result_read(struct ast_channel *chan, const char *cmd, char *da
goto finish ;
goto finish ;
}
}
if ( num & & num < = drds - > num_results ) {
if ( num & & drds- > num_results > 0 & & num < = drds - > num_results ) {
snprintf ( buf , len , " %s/%s " , drds - > results [ num - 1 ] . tech , drds - > results [ num - 1 ] . dest ) ;
snprintf ( buf , len , " %s/%s " , drds - > results [ num - 1 ] . tech , drds - > results [ num - 1 ] . dest ) ;
res = 0 ;
res = 0 ;
} else
} else