[Home]

Summary:ASTERISK-02021: [patch][src-audit] channels directory -- last one
Reporter:Rob Gagnon (rgagnon)Labels:
Date Opened:2004-07-15 01:20:42Date Closed:2008-01-15 15:02:36.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) channels.c.patch.txt
Description:This should be the last in a series of patches to secure most, if not all strcpy(), strcat(), sprintf() functions by changing them to strncpy(), strncat(), and snprintf() as appropriate.

Also, existing strncpy()'s and snprintf()'s were checked for the need, or lack thereof, of "-1"

****** ADDITIONAL INFORMATION ******

[disclaimed]

Note two function prototypes changed to protect a couple of buffers, and a portion of another function changed for readability:
=========================================================
chan_sip.c:
 static char *get_calleridname(char *input, char *output)
became:
 static char *get_calleridname(char *input, char *output,
   size_t outputsize)

This allows for protection of "output" in that function.
=========================================================

chan_zap.c:
 static void build_status(char *s, int status, int active)
became:
 static void build_status(char *s, size_t len, int status,
   int active)

Again, this was to allow protection of the buffer "s" inside that function.

=========================================================

chan_skinny.c:
 Look for the hunk starting:
 "@@ -2177,11 +2179,21 @@ static int handle_message"

Check the logic for the changes I made to calculate the value for the "char d" from "int digit"

The original did not protect for "digit" being between 10 and 13, and that would be hard to fit as a string into a single "char"
Comments:By: Mark Spencer (markster) 2004-07-16 00:54:33

Added to CVS, thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:02:36.000-0600

Repository: asterisk
Revision: 3446

U   trunk/channels/chan_agent.c
U   trunk/channels/chan_alsa.c
U   trunk/channels/chan_h323.c
U   trunk/channels/chan_iax.c
U   trunk/channels/chan_iax2.c
U   trunk/channels/chan_mgcp.c
U   trunk/channels/chan_modem.c
U   trunk/channels/chan_modem_bestdata.c
U   trunk/channels/chan_nbs.c
U   trunk/channels/chan_oss.c
U   trunk/channels/chan_phone.c
U   trunk/channels/chan_sip.c
U   trunk/channels/chan_skinny.c
U   trunk/channels/chan_vofr.c
U   trunk/channels/chan_vpb.c
U   trunk/channels/chan_zap.c
U   trunk/channels/iax2-provision.c

------------------------------------------------------------------------
r3446 | markster | 2008-01-15 15:02:36 -0600 (Tue, 15 Jan 2008) | 2 lines

Last set of strncpy/snprintf updates (bug ASTERISK-2021)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=3446