]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix #320: potential memory corruption due to size miscomputation upton
authorGeorge Thessalonikefs <george@nlnetlabs.nl>
Wed, 21 Oct 2020 15:44:04 +0000 (17:44 +0200)
committerGeorge Thessalonikefs <george@nlnetlabs.nl>
Wed, 21 Oct 2020 15:44:04 +0000 (17:44 +0200)
  custom region alloc init.

doc/Changelog
util/regional.c

index 9d484a96de6f9fe4d4a1ba707ce89f8582747e75..d3aa5d2adb8a3ce2c9a82194a3f36e7e668490a8 100644 (file)
@@ -1,6 +1,8 @@
 21 October 2020: George
        - Fix #327: net/if.h check fails on some darwin versions; contribution by
          Joshua Root.
+       - Fix #320: potential memory corruption due to size miscomputation upton
+         custom region alloc init.
 
 21 October 2020: Wouter
        - Merge PR #228 : infra-keep-probing option to probe hosts that are
index 01a042b6156a495dd98055c840be36a16df00ea2..bd67ecf50af348796beb00c6acdd57fcc93069f9 100644 (file)
@@ -89,8 +89,9 @@ regional_init(struct regional* r)
 static struct regional*
 regional_create_custom_large_object(size_t size, size_t large_object_size)
 {
-       struct regional* r = (struct regional*)malloc(size);
+       struct regional* r;
        size = ALIGN_UP(size, ALIGNMENT);
+       r = (struct regional*)malloc(size);
        log_assert(sizeof(struct regional) <= size);
        if(!r) return NULL;
        r->first_size = size;