summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/nmbd/nmbd_namequery.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/nmbd/nmbd_namequery.c b/source3/nmbd/nmbd_namequery.c
index 7a820a7148..8995e9ac52 100644
--- a/source3/nmbd/nmbd_namequery.c
+++ b/source3/nmbd/nmbd_namequery.c
@@ -81,6 +81,14 @@ static void query_name_response( struct subnet_record *subrec,
}
else
{
+ if (!nmb->answers)
+ {
+ dbgtext( "query_name_response: On subnet %s ", subrec->subnet_name );
+ dbgtext( "IP %s ", inet_ntoa(p->ip) );
+ dbgtext( "returned a success response with no answer\n" );
+ return;
+ }
+
success = True;
putip((char *)&answer_ip,&nmb->answers->rdata[2]);
@@ -102,7 +110,8 @@ static void query_name_response( struct subnet_record *subrec,
{
if( DEBUGLVL( 0 ) )
{
- putip( (char *)&answer_ip, &nmb->answers->rdata[2] );
+ if (nmb->answers)
+ putip( (char *)&answer_ip, &nmb->answers->rdata[2] );
dbgtext( "query_name_response: " );
dbgtext( "Multiple (%d) responses ", rrec->num_msgs );
dbgtext( "received for a query on subnet %s ", subrec->subnet_name );