]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Properly initialize bitmap
authorWillem Toorop <willem@nlnetlabs.nl>
Tue, 16 Jul 2013 20:08:42 +0000 (22:08 +0200)
committerWillem Toorop <willem@nlnetlabs.nl>
Tue, 16 Jul 2013 20:08:42 +0000 (22:08 +0200)
README.git [moved from README.svn with 100% similarity]
dnssec.c
rr.c

similarity index 100%
rename from README.svn
rename to README.git
index 56c6b6289fd1913082623f1d7aa852f9b1c1c860..856275d2fbce8266064217775a48f2cea49213f7 100644 (file)
--- a/dnssec.c
+++ b/dnssec.c
@@ -731,7 +731,7 @@ ldns_dnssec_create_nsec_bitmap(ldns_rr_type rr_type_list[],
        if (sz > 0) {
                /* Format rdf data according RFC3845 Section 2.1.2 (see above)
                 */
-               dptr = data = LDNS_XMALLOC(uint8_t, sz);
+               dptr = data = LDNS_CALLOC(uint8_t, sz);
                if (!data) {
                        return NULL;
                }
diff --git a/rr.c b/rr.c
index cb97116111ddeb23aadc6511b8931f3c8a415704..0ecc6970c3ef8942d91c4b2814cb19a714137018 100644 (file)
--- a/rr.c
+++ b/rr.c
@@ -2460,6 +2460,7 @@ ldns_rdf_bitmap_known_rr_types_set(ldns_rdf** rdf, int value)
                /* Format rdf data according RFC3845 Section 2.1.2 (see above)
                 */
                dptr = data = LDNS_XMALLOC(uint8_t, sz);
+               memset(data, value, sz);
                if (!data) {
                        return LDNS_STATUS_MEM_ERR;
                }
@@ -2467,7 +2468,6 @@ ldns_rdf_bitmap_known_rr_types_set(ldns_rdf** rdf, int value)
                        if (windows[i]) {
                                *dptr++ = (uint8_t)i;
                                *dptr++ = (uint8_t)(windows[i] / 8 + 1);
-                               memset(dptr, value, dptr[-1]);
                                dptr += dptr[-1];
                        }
                }