]> git.ipfire.org Git - thirdparty/asterisk.git/commit
astfd: Fix buffer overflow in DEBUG_FD_LEAKS. 63/763/1
authorWalter Doekes <walter+asterisk@wjd.nu>
Thu, 2 Jul 2015 10:16:26 +0000 (12:16 +0200)
committerWalter Doekes <walter+asterisk@wjd.nu>
Thu, 2 Jul 2015 10:24:33 +0000 (05:24 -0500)
commit6551e16e03cc8e172d9ad8f75a040750a29a5e6e
treeb5362a02ecf1469c019842e40c8292c4149221d3
parent69bfa518a02cbd69b364e5b0a500fc160e7b285d
astfd: Fix buffer overflow in DEBUG_FD_LEAKS.

If DEBUG_FD_LEAKS was used and more file descriptors than the default of
1024 were available, some DEBUG_FD_LEAKS-patched functions would
overwrite memory past the fixed-size (1024) fdleaks buffer.

This change:
- adds bounds checks to __ast_fdleak_fopen and __ast_fdleak_pipe
- consistently uses ARRAY_LEN() instead of sizeof() or 1023 or 1024
- stores pointers to constants instead of copying the contents
- reorders the fdleaks struct for possibly tighter packing
- adds a tiny bit of documentation

ASTERISK-25212 #close

Change-Id: Iacb69e7701c0f0a113786bd946cea5b6335a85e5
main/astfd.c