]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Suppress clang warnings
authorWillem Toorop <willem@nlnetlabs.nl>
Wed, 24 Jul 2019 13:02:45 +0000 (09:02 -0400)
committerWillem Toorop <willem@nlnetlabs.nl>
Wed, 24 Jul 2019 13:02:45 +0000 (09:02 -0400)
rr.c

diff --git a/rr.c b/rr.c
index 9a834e37cf3931ff8b51fe01e454b162bac1325e..6642aca775120a8bbcdffbeeb2692ac0a39477e9 100644 (file)
--- 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 */