From: Willem Toorop Date: Wed, 24 Jul 2019 13:02:45 +0000 (-0400) Subject: Suppress clang warnings X-Git-Tag: release-1.7.1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d431b13b1b8477cac46780f1826e96e0300099a8;p=thirdparty%2Fldns.git Suppress clang warnings --- diff --git a/rr.c b/rr.c index 9a834e37..6642aca7 100644 --- a/rr.c +++ b/rr.c @@ -125,6 +125,7 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, ldns_rr_class clas_val; char *clas = NULL; char *type = NULL; + size_t type_sz; char *rdata = NULL; char *rd = NULL; char *xtok = NULL; /* For RDF types with spaces (i.e. extra tokens) */ @@ -208,11 +209,12 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, */ if (clas_val == 0) { clas_val = LDNS_RR_CLASS_IN; - type = LDNS_XMALLOC(char, strlen(ttl) + 1); + type_sz = strlen(ttl) + 1; + type = LDNS_XMALLOC(char, type_sz); if (!type) { goto memerror; } - strlcpy(type, ttl, strlen(ttl) + 1); + strlcpy(type, ttl, type_sz); } } else { if (-1 == ldns_bget_token( @@ -227,11 +229,12 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, */ if (clas_val == 0) { clas_val = LDNS_RR_CLASS_IN; - type = LDNS_XMALLOC(char, strlen(clas) + 1); + type_sz = strlen(clas) + 1; + type = LDNS_XMALLOC(char, type_sz); if (!type) { goto memerror; } - strlcpy(type, clas, strlen(clas) + 1); + strlcpy(type, clas, type_sz); } } /* the rest should still be waiting for us */