@ -44,7 +44,7 @@ static ares_status_t ares_dns_write_header(const ares_dns_record_t *dnsrec,
/* ID */
status = ares__buf_append_be16 ( buf , dnsrec - > id ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* Flags */
@ -103,31 +103,31 @@ static ares_status_t ares_dns_write_header(const ares_dns_record_t *dnsrec,
status = ares__buf_append_be16 ( buf , u16 ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* QDCOUNT */
status = ares__buf_append_be16 ( buf , ( unsigned short ) dnsrec - > qdcount ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* ANCOUNT */
status = ares__buf_append_be16 ( buf , ( unsigned short ) dnsrec - > ancount ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* NSCOUNT */
status = ares__buf_append_be16 ( buf , ( unsigned short ) dnsrec - > nscount ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* ARCOUNT */
status = ares__buf_append_be16 ( buf , ( unsigned short ) dnsrec - > arcount ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
return ARES_SUCCESS ;
@ -159,13 +159,13 @@ static ares_status_t ares_dns_write_questions(const ares_dns_record_t *dnsrec,
/* Type */
status = ares__buf_append_be16 ( buf , ( unsigned short ) qtype ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* Class */
status = ares__buf_append_be16 ( buf , ( unsigned short ) qclass ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
}
@ -182,7 +182,7 @@ static ares_status_t ares_dns_write_rr_name(ares__buf_t *buf,
name = ares_dns_rr_get_str ( rr , key ) ;
if ( name = = NULL ) {
return ARES_EFORMERR ;
return ARES_EFORMERR ; /* LCOV_EXCL_LINE: DefensiveCoding */
}
return ares__dns_name_write ( buf , namelist , validate_hostname , name ) ;
@ -198,7 +198,7 @@ static ares_status_t ares_dns_write_rr_str(ares__buf_t *buf,
str = ares_dns_rr_get_str ( rr , key ) ;
if ( str = = NULL ) {
return ARES_EFORMERR ;
return ARES_EFORMERR ; /* LCOV_EXCL_LINE: DefensiveCoding */
}
len = ares_strlen ( str ) ;
@ -209,7 +209,7 @@ static ares_status_t ares_dns_write_rr_str(ares__buf_t *buf,
/* Write 1 byte length */
status = ares__buf_append_byte ( buf , ( unsigned char ) ( len & 0xFF ) ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
if ( len = = 0 ) {
@ -232,7 +232,7 @@ static ares_status_t ares_dns_write_rr_binstrs(ares__buf_t *buf,
bin = ares_dns_rr_get_bin ( rr , key , & bin_len ) ;
if ( bin = = NULL ) {
return ARES_EFORMERR ;
return ARES_EFORMERR ; /* LCOV_EXCL_LINE: DefensiveCoding */
}
/* split into possible multiple 255-byte or less length strings */
ptr = bin ;
@ -246,14 +246,14 @@ static ares_status_t ares_dns_write_rr_binstrs(ares__buf_t *buf,
/* Length */
status = ares__buf_append_byte ( buf , ( unsigned char ) ( len & 0xFF ) ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* String */
if ( len ) {
status = ares__buf_append ( buf , ptr , len ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
}
@ -269,7 +269,7 @@ static ares_status_t ares_dns_write_rr_be32(ares__buf_t *buf,
ares_dns_rr_key_t key )
{
if ( ares_dns_rr_key_datatype ( key ) ! = ARES_DATATYPE_U32 ) {
return ARES_EFORMERR ;
return ARES_EFORMERR ; /* LCOV_EXCL_LINE: DefensiveCoding */
}
return ares__buf_append_be32 ( buf , ares_dns_rr_get_u32 ( rr , key ) ) ;
}
@ -279,7 +279,7 @@ static ares_status_t ares_dns_write_rr_be16(ares__buf_t *buf,
ares_dns_rr_key_t key )
{
if ( ares_dns_rr_key_datatype ( key ) ! = ARES_DATATYPE_U16 ) {
return ARES_EFORMERR ;
return ARES_EFORMERR ; /* LCOV_EXCL_LINE: DefensiveCoding */
}
return ares__buf_append_be16 ( buf , ares_dns_rr_get_u16 ( rr , key ) ) ;
}
@ -289,7 +289,7 @@ static ares_status_t ares_dns_write_rr_u8(ares__buf_t *buf,
ares_dns_rr_key_t key )
{
if ( ares_dns_rr_key_datatype ( key ) ! = ARES_DATATYPE_U8 ) {
return ARES_EFORMERR ;
return ARES_EFORMERR ; /* LCOV_EXCL_LINE: DefensiveCoding */
}
return ares__buf_append_byte ( buf , ares_dns_rr_get_u8 ( rr , key ) ) ;
}
@ -303,7 +303,7 @@ static ares_status_t ares_dns_write_rr_a(ares__buf_t *buf,
addr = ares_dns_rr_get_addr ( rr , ARES_RR_A_ADDR ) ;
if ( addr = = NULL ) {
return ARES_EFORMERR ;
return ARES_EFORMERR ; /* LCOV_EXCL_LINE: DefensiveCoding */
}
return ares__buf_append ( buf , ( const unsigned char * ) addr , sizeof ( * addr ) ) ;
@ -348,25 +348,25 @@ static ares_status_t ares_dns_write_rr_soa(ares__buf_t *buf,
/* SERIAL */
status = ares_dns_write_rr_be32 ( buf , rr , ARES_RR_SOA_SERIAL ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* REFRESH */
status = ares_dns_write_rr_be32 ( buf , rr , ARES_RR_SOA_REFRESH ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* RETRY */
status = ares_dns_write_rr_be32 ( buf , rr , ARES_RR_SOA_RETRY ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* EXPIRE */
status = ares_dns_write_rr_be32 ( buf , rr , ARES_RR_SOA_EXPIRE ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* MINIMUM */
@ -408,7 +408,7 @@ static ares_status_t ares_dns_write_rr_mx(ares__buf_t *buf,
/* PREFERENCE */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_MX_PREFERENCE ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* EXCHANGE */
@ -437,43 +437,43 @@ static ares_status_t ares_dns_write_rr_sig(ares__buf_t *buf,
/* TYPE COVERED */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_SIG_TYPE_COVERED ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* ALGORITHM */
status = ares_dns_write_rr_u8 ( buf , rr , ARES_RR_SIG_ALGORITHM ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* LABELS */
status = ares_dns_write_rr_u8 ( buf , rr , ARES_RR_SIG_LABELS ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* ORIGINAL TTL */
status = ares_dns_write_rr_be32 ( buf , rr , ARES_RR_SIG_ORIGINAL_TTL ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* EXPIRATION */
status = ares_dns_write_rr_be32 ( buf , rr , ARES_RR_SIG_EXPIRATION ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* INCEPTION */
status = ares_dns_write_rr_be32 ( buf , rr , ARES_RR_SIG_INCEPTION ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* KEY TAG */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_SIG_KEY_TAG ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* SIGNERS NAME */
@ -501,7 +501,7 @@ static ares_status_t ares_dns_write_rr_aaaa(ares__buf_t *buf,
addr = ares_dns_rr_get_addr6 ( rr , ARES_RR_AAAA_ADDR ) ;
if ( addr = = NULL ) {
return ARES_EFORMERR ;
return ARES_EFORMERR ; /* LCOV_EXCL_LINE: DefensiveCoding */
}
return ares__buf_append ( buf , ( const unsigned char * ) addr , sizeof ( * addr ) ) ;
@ -516,19 +516,19 @@ static ares_status_t ares_dns_write_rr_srv(ares__buf_t *buf,
/* PRIORITY */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_SRV_PRIORITY ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* WEIGHT */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_SRV_WEIGHT ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* PORT */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_SRV_PORT ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* TARGET */
@ -545,31 +545,31 @@ static ares_status_t ares_dns_write_rr_naptr(ares__buf_t *buf,
/* ORDER */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_NAPTR_ORDER ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* PREFERENCE */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_NAPTR_PREFERENCE ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* FLAGS */
status = ares_dns_write_rr_str ( buf , rr , ARES_RR_NAPTR_FLAGS ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* SERVICES */
status = ares_dns_write_rr_str ( buf , rr , ARES_RR_NAPTR_SERVICES ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* REGEXP */
status = ares_dns_write_rr_str ( buf , rr , ARES_RR_NAPTR_REGEXP ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* REPLACEMENT */
@ -601,7 +601,7 @@ static ares_status_t ares_dns_write_rr_opt(ares__buf_t *buf,
/* Class -> UDP Size */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_OPT_UDP_SIZE ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* TTL -> rcode (u8) << 24 | version (u8) << 16 | flags (u16) */
@ -611,7 +611,7 @@ static ares_status_t ares_dns_write_rr_opt(ares__buf_t *buf,
status = ares__buf_append_be32 ( buf , ttl ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* Now go back to real end */
@ -631,20 +631,20 @@ static ares_status_t ares_dns_write_rr_opt(ares__buf_t *buf,
/* BE16 option */
status = ares__buf_append_be16 ( buf , opt ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* BE16 length */
status = ares__buf_append_be16 ( buf , ( unsigned short ) ( val_len & 0xFFFF ) ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* Value */
if ( val & & val_len ) {
status = ares__buf_append ( buf , val , val_len ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
}
}
@ -665,19 +665,19 @@ static ares_status_t ares_dns_write_rr_tlsa(ares__buf_t *buf,
/* CERT_USAGE */
status = ares_dns_write_rr_u8 ( buf , rr , ARES_RR_TLSA_CERT_USAGE ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* SELECTOR */
status = ares_dns_write_rr_u8 ( buf , rr , ARES_RR_TLSA_SELECTOR ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* MATCH */
status = ares_dns_write_rr_u8 ( buf , rr , ARES_RR_TLSA_MATCH ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* DATA -- binary, rest of buffer, required to be non-zero length */
@ -699,7 +699,7 @@ static ares_status_t ares_dns_write_rr_svcb(ares__buf_t *buf,
/* PRIORITY */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_SVCB_PRIORITY ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* TARGET */
@ -720,20 +720,20 @@ static ares_status_t ares_dns_write_rr_svcb(ares__buf_t *buf,
/* BE16 option */
status = ares__buf_append_be16 ( buf , opt ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* BE16 length */
status = ares__buf_append_be16 ( buf , ( unsigned short ) ( val_len & 0xFFFF ) ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* Value */
if ( val & & val_len ) {
status = ares__buf_append ( buf , val , val_len ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
}
}
@ -750,7 +750,7 @@ static ares_status_t ares_dns_write_rr_https(ares__buf_t *buf,
/* PRIORITY */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_HTTPS_PRIORITY ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* TARGET */
@ -771,20 +771,20 @@ static ares_status_t ares_dns_write_rr_https(ares__buf_t *buf,
/* BE16 option */
status = ares__buf_append_be16 ( buf , opt ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* BE16 length */
status = ares__buf_append_be16 ( buf , ( unsigned short ) ( val_len & 0xFFFF ) ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* Value */
if ( val & & val_len ) {
status = ares__buf_append ( buf , val , val_len ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
}
}
@ -803,13 +803,13 @@ static ares_status_t ares_dns_write_rr_uri(ares__buf_t *buf,
/* PRIORITY */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_URI_PRIORITY ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* WEIGHT */
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_URI_WEIGHT ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* TARGET -- not in DNS string format, rest of buffer, required to be
@ -836,13 +836,13 @@ static ares_status_t ares_dns_write_rr_caa(ares__buf_t *buf,
/* CRITICAL */
status = ares_dns_write_rr_u8 ( buf , rr , ARES_RR_CAA_CRITICAL ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* Tag */
status = ares_dns_write_rr_str ( buf , rr , ARES_RR_CAA_TAG ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* Value - binary! (remaining buffer */
@ -877,7 +877,7 @@ static ares_status_t ares_dns_write_rr_raw_rr(ares__buf_t *buf,
status = ares_dns_write_rr_be16 ( buf , rr , ARES_RR_RAW_RR_TYPE ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* Now go back to real end */
@ -919,7 +919,7 @@ static ares_status_t ares_dns_write_rr(const ares_dns_record_t *dnsrec,
rr = ares_dns_record_rr_get_const ( dnsrec , section , i ) ;
if ( rr = = NULL ) {
return ARES_EFORMERR ;
return ARES_EFORMERR ; /* LCOV_EXCL_LINE: DefensiveCoding */
}
type = ares_dns_rr_get_type ( rr ) ;
@ -938,14 +938,14 @@ static ares_status_t ares_dns_write_rr(const ares_dns_record_t *dnsrec,
/* Type */
status = ares__buf_append_be16 ( buf , ( unsigned short ) type ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* Class */
status =
ares__buf_append_be16 ( buf , ( unsigned short ) ares_dns_rr_get_class ( rr ) ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* TTL */
@ -957,14 +957,14 @@ static ares_status_t ares_dns_write_rr(const ares_dns_record_t *dnsrec,
}
status = ares__buf_append_be32 ( buf , ttl ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* Length */
pos_len = ares__buf_len ( buf ) ; /* Save to write real length later */
status = ares__buf_append_be16 ( buf , 0 ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
/* Data */
@ -1047,7 +1047,7 @@ static ares_status_t ares_dns_write_rr(const ares_dns_record_t *dnsrec,
status = ares__buf_append_be16 ( buf , ( unsigned short ) ( rdlength & 0xFFFF ) ) ;
if ( status ! = ARES_SUCCESS ) {
return status ;
return status ; /* LCOV_EXCL_LINE: OutOfMemory */
}
status = ares__buf_set_length ( buf , end_length ) ;
@ -1075,7 +1075,7 @@ ares_status_t ares_dns_write(const ares_dns_record_t *dnsrec,
b = ares__buf_create ( ) ;
if ( b = = NULL ) {
return ARES_ENOMEM ;
return ARES_ENOMEM ; /* LCOV_EXCL_LINE: OutOfMemory */
}
status = ares_dns_write_header ( dnsrec , b ) ;