@ -44,9 +44,9 @@
# include "ares_data.h"
# include "ares_private.h"
int
ares_parse_txt_reply ( const unsigned char * abuf , int alen ,
struct ares_txt_reply * * txt_out )
static int
ares__ parse_txt_reply ( const unsigned char * abuf , int alen ,
int ex , void * * txt_out )
{
size_t substr_len ;
unsigned int qdcount , ancount , i ;
@ -55,9 +55,9 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
int status , rr_type , rr_class , rr_len ;
long len ;
char * hostname = NULL , * rr_name = NULL ;
struct ares_txt_reply * txt_head = NULL ;
struct ares_txt_reply * txt_last = NULL ;
struct ares_txt_reply * txt_curr ;
struct ares_txt_ext * txt_head = NULL ;
struct ares_txt_ext * txt_last = NULL ;
struct ares_txt_ext * txt_curr ;
/* Set *txt_out to NULL for all failure cases. */
* txt_out = NULL ;
@ -133,10 +133,9 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
break ;
}
+ + strptr ;
/* Allocate storage for this TXT answer appending it to the list */
txt_curr = ares_malloc_data ( ARES_DATATYPE_TXT_REPLY ) ;
txt_curr = ares_malloc_data ( ex ? ARES_DATATYPE_TXT_EXT :
ARES_DATATYPE_TXT_REPLY ) ;
if ( ! txt_curr )
{
status = ARES_ENOMEM ;
@ -152,6 +151,8 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
}
txt_last = txt_curr ;
if ( ex )
txt_curr - > record_start = ( strptr = = aptr ) ;
txt_curr - > length = substr_len ;
txt_curr - > txt = ares_malloc ( substr_len + 1 /* Including null byte */ ) ;
if ( txt_curr - > txt = = NULL )
@ -159,6 +160,8 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
status = ARES_ENOMEM ;
break ;
}
+ + strptr ;
memcpy ( ( char * ) txt_curr - > txt , strptr , substr_len ) ;
/* Make sure we NULL-terminate */
@ -200,3 +203,18 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
return ARES_SUCCESS ;
}
int
ares_parse_txt_reply ( const unsigned char * abuf , int alen ,
struct ares_txt_reply * * txt_out )
{
return ares__parse_txt_reply ( abuf , alen , 0 , ( void * * ) txt_out ) ;
}
int
ares_parse_txt_reply_ext ( const unsigned char * abuf , int alen ,
struct ares_txt_ext * * txt_out )
{
return ares__parse_txt_reply ( abuf , alen , 1 , ( void * * ) txt_out ) ;
}