]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] clean up bufsize errors
authorEvan Hunt <each@isc.org>
Thu, 14 Sep 2017 04:18:26 +0000 (21:18 -0700)
committerEvan Hunt <each@isc.org>
Thu, 14 Sep 2017 04:18:26 +0000 (21:18 -0700)
lib/dns/name.c
lib/dns/zone.c

index 46976da3729faa8281b3c79d05346fd929309816..760b8eeda9c3c9dbc2989c479b08333ea632a5b1 100644 (file)
@@ -1657,7 +1657,7 @@ dns_name_tofilenametext(const dns_name_t *name, isc_boolean_t omit_final_dot,
                                        trem--;
                                        nlen--;
                                } else {
-                                       if (trem < 3)
+                                       if (trem < 4)
                                                return (ISC_R_NOSPACE);
                                        snprintf(tdata, trem, "%%%02X", c);
                                        tdata += 3;
index 23187c406fd25a1c6b8cdf362dd8d6cd1f541631..2936842bef953432dc05583f6ac5de321191997c 100644 (file)
@@ -1383,12 +1383,14 @@ dns_zone_getdbtype(dns_zone_t *zone, char ***argv, isc_mem_t *mctx) {
                size += strlen(zone->db_argv[i]) + 1;
        mem = isc_mem_allocate(mctx, size);
        if (mem != NULL) {
+               size_t remaining;
                tmp = mem;
                tmp2 = mem;
                tmp2 += (zone->db_argc + 1) * sizeof(char *);
                for (i = 0; i < zone->db_argc; i++) {
+                       remaining = (size_t)(mem - tmp2);
                        *tmp++ = tmp2;
-                       strlcpy(tmp2, zone->db_argv[i], size);
+                       strlcpy(tmp2, zone->db_argv[i], remaining);
                        tmp2 += strlen(tmp2) + 1;
                }
                *tmp = NULL;