Skip to content
Snippets Groups Projects
  • Matthew Jordan's avatar
    f7829006
    Fix a variety of potential buffer overflows · f7829006
    Matthew Jordan authored
    * chan_mobile: Fixed an overrun where the cind_state buffer (an integer array
      of size 16) would be overrun due to improper bounds checking. At worst, the
      buffer can be overrun by a total of 48 bytes (assuming 4-byte integers),
      which would still leave it within the allocated memory of struct hfp.  This
      would corrupt other elements in that struct but not necessarily cause any
      further issues.
    
    * app_sms: The array imsg is of size 250, while the array (ud) that the data
      is copied into is of size 160.  If the size of the inbound message is 
      greater then 160, up to 90 bytes could be overrun in ud.  This would corrupt
      the user data header (array udh) adjacent to ud.
    
    * chan_unistim: A number of invalid memmoves are corrected.  These would move
      data (which may or may not be valid) into the ends of these buffers.
    
    * asterisk: ast_console_toggle_loglevel does not check that the console log
      level being set is less then or equal to the allowed log levels of 32.
    
    * format_pref: In ast_codec_pref_prepend, if any occurrence of the specified
      codec is not found, the value used to index into the array pref->order
      would be one greater then the maximum size of the array.
    
    * jitterbuf: If the element being placed into the jitter buffer lands in the
      last available slot in the jitter history buffer, the insertion sort attempts
      to move the last entry in the buffer into one slot past the maximum length
      of the buffer.  Note that this occurred for both the min and max jitter
      history buffers.
    
    * tdd: If a read from fsk_serial returns a character that is greater then 32,
      an attempt to read past one of the statically defined arrays containing the
      values that character maps to would occur.
    
    * localtime: struct ast_time and tm are not the same size - ast_time is larger,
      although it contains the elements of tm within it in the same layout.  Hence,
      when using memcpy to copy the contents of tm into ast_time, the size of tm
      should be used, as opposed to the size of ast_time.
    
    * extconf: this treats ast_timing's minmask array as if it had a length of 48,
      when it has defined the size of the array as 24.  pbx.h defines minmask as
      having a size of 48.
    
    (issue ASTERISK-19668)
    Reported by: Matt Jordan
    ........
    
    Merged revisions 362485 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 362496 from http://svn.asterisk.org/svn/asterisk/branches/10
    
    
    
    git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
    f7829006
    History
    Fix a variety of potential buffer overflows
    Matthew Jordan authored
    * chan_mobile: Fixed an overrun where the cind_state buffer (an integer array
      of size 16) would be overrun due to improper bounds checking. At worst, the
      buffer can be overrun by a total of 48 bytes (assuming 4-byte integers),
      which would still leave it within the allocated memory of struct hfp.  This
      would corrupt other elements in that struct but not necessarily cause any
      further issues.
    
    * app_sms: The array imsg is of size 250, while the array (ud) that the data
      is copied into is of size 160.  If the size of the inbound message is 
      greater then 160, up to 90 bytes could be overrun in ud.  This would corrupt
      the user data header (array udh) adjacent to ud.
    
    * chan_unistim: A number of invalid memmoves are corrected.  These would move
      data (which may or may not be valid) into the ends of these buffers.
    
    * asterisk: ast_console_toggle_loglevel does not check that the console log
      level being set is less then or equal to the allowed log levels of 32.
    
    * format_pref: In ast_codec_pref_prepend, if any occurrence of the specified
      codec is not found, the value used to index into the array pref->order
      would be one greater then the maximum size of the array.
    
    * jitterbuf: If the element being placed into the jitter buffer lands in the
      last available slot in the jitter history buffer, the insertion sort attempts
      to move the last entry in the buffer into one slot past the maximum length
      of the buffer.  Note that this occurred for both the min and max jitter
      history buffers.
    
    * tdd: If a read from fsk_serial returns a character that is greater then 32,
      an attempt to read past one of the statically defined arrays containing the
      values that character maps to would occur.
    
    * localtime: struct ast_time and tm are not the same size - ast_time is larger,
      although it contains the elements of tm within it in the same layout.  Hence,
      when using memcpy to copy the contents of tm into ast_time, the size of tm
      should be used, as opposed to the size of ast_time.
    
    * extconf: this treats ast_timing's minmask array as if it had a length of 48,
      when it has defined the size of the array as 24.  pbx.h defines minmask as
      having a size of 48.
    
    (issue ASTERISK-19668)
    Reported by: Matt Jordan
    ........
    
    Merged revisions 362485 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 362496 from http://svn.asterisk.org/svn/asterisk/branches/10
    
    
    
    git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
extconf.c 183.20 KiB