]> git.ipfire.org Git - thirdparty/bind9.git/commit
Checked array allocation arithmetic with isc_mem_get and friends
authorOndřej Surý <ondrej@isc.org>
Wed, 23 Aug 2023 06:56:22 +0000 (08:56 +0200)
committerOndřej Surý <ondrej@isc.org>
Thu, 31 Aug 2023 20:08:35 +0000 (22:08 +0200)
commit6272482113ff2f2d3de333e56eb9c63e36b8cc8f
treef007121a7383ce3b670f78a2e80d7d2e73fe8dda
parent8ff4895628f0e15e162d034f9e384b0e62b9ae4f
Checked array allocation arithmetic with isc_mem_get and friends

Add new isc_mem_cget(), isc_mem_creget(), and isc_mem_cput() macros to
complement the isc_mem_callocate() (which works like calloc()).

The overflow checks are implemented as macros in the <isc/mem.h>, so
that the compiler can see that the element size is constant: it should
always be `sizeof(something)`.
lib/isc/include/isc/mem.h
lib/isc/mem.c