]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4218. [bug] Potential null pointer dereference on out of memory ...
authorMark Andrews <marka@isc.org>
Fri, 18 Sep 2015 21:12:02 +0000 (07:12 +1000)
committerMark Andrews <marka@isc.org>
Fri, 18 Sep 2015 21:12:02 +0000 (07:12 +1000)
CHANGES
lib/isc/unix/file.c
lib/isc/win32/file.c

diff --git a/CHANGES b/CHANGES
index fe6ffffa237f8f92849bcb29abfd5f22ed31bfde..8aa2dcba1abb591738c2c99773f5cb509cb6a496 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+4218.  [bug]           Potential null pointer dereference on out of memory                             if mmap is not supported. [RT #40777]
+
 4217.  [protocol]      Add support for CSYNC. [RT #40532]
 
 4216.  [cleanup]       Silence static analysis warnings. [RT #40649]
index 5e671d5b1797e9fa238bd5d126c2aaa5d3f25224..3a76e0833c37a3063d7fd6b0f18fba7ab0f88453 100644 (file)
@@ -678,6 +678,9 @@ isc_file_mmap(void *addr, size_t len, int prot,
                len = end - offset;
 
        buf = malloc(len);
+       if (buf == NULL)
+               return (NULL);
+
        ret = read(fd, buf, len);
        if (ret != (ssize_t) len) {
                free(buf);
index ba481228adc4332513c078292313779af2c5396f..99e52d2e96445a6fff0358a3caed14a449b56cd8 100644 (file)
@@ -757,6 +757,9 @@ isc_file_mmap(void *addr, size_t len, int prot,
                len = end - offset;
 
        buf = malloc(len);
+       if (buf == NULL)
+               return (NULL);
+
        ret = read(fd, buf, (unsigned int) len);
        if (ret != (ssize_t) len) {
                free(buf);