Skip to content
Snippets Groups Projects
  • Walter Doekes's avatar
    028554fa
    astfd: Fix buffer overflow in DEBUG_FD_LEAKS. · 028554fa
    Walter Doekes authored
    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
    028554fa
    History
    astfd: Fix buffer overflow in DEBUG_FD_LEAKS.
    Walter Doekes authored
    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