]> git.ipfire.org Git - thirdparty/asterisk.git/commit
astfd: Fix buffer overflow in DEBUG_FD_LEAKS. 62/762/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:22:55 +0000 (12:22 +0200)
commit028554faab9d1e158c1ab00a8f45dc1d7e6b4848
treead5909c04f7243477e2d7f9fd20603b119fc5320
parent9b74dcb687f4e05da012d80ee54d04df82210520
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