[asterisk-bugs] [Asterisk 0010843]: [JANITOR] Change simple snprintf to ast_copy_string

noreply at bugs.digium.com noreply at bugs.digium.com
Mon Oct 1 10:04:10 CDT 2007


The following issue has been ASSIGNED. 
====================================================================== 
http://bugs.digium.com/view.php?id=10843 
====================================================================== 
Reported By:                Corydon76
Assigned To:                russell
====================================================================== 
Project:                    Asterisk
Issue ID:                   10843
Category:                   Core-General
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     assigned
Asterisk Version:            SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             09-28-2007 09:13 CDT
Last Modified:              10-01-2007 10:04 CDT
====================================================================== 
Summary:                    [JANITOR] Change simple snprintf to ast_copy_string
Description: 
There are a good number of places in the code that we needlessly call
snprintf(), when a plain string copy (ast_copy_string) will do.  Note that
a
simple rearrangement of the arguments is necessary, from:

snprintf(A, B, C);

to

ast_copy_string(A, C, B);

You can find most of the cases in the code with the following shell
command:

find . -name \*.c -exec grep -EHn 'snprintf\([^,]*,[^,]*,[^,]*\);' {} \;
====================================================================== 

---------------------------------------------------------------------- 
 svnbot - 10-01-07 10:04  
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 84173

U   trunk/apps/app_meetme.c
U   trunk/apps/app_minivm.c
U   trunk/channels/chan_iax2.c
U   trunk/channels/chan_mgcp.c
U   trunk/channels/chan_misdn.c
U   trunk/channels/chan_sip.c
U   trunk/channels/chan_skinny.c
U   trunk/channels/iax2-parser.c
U   trunk/main/asterisk.c
U   trunk/main/frame.c
U   trunk/main/rtp.c
U   trunk/main/say.c
U   trunk/pbx/dundi-parser.c
U   trunk/res/res_config_odbc.c

------------------------------------------------------------------------
r84173 | russell | 2007-10-01 10:04:09 -0500 (Mon, 01 Oct 2007) | 8 lines

Corydon posted this janitor project to the bug tracker and mvanbaak
provided
a patch for it.  It replaces a bunch of simple calls to snprintf with
ast_copy_string

(closes issue http://bugs.digium.com/view.php?id=10843)
Reported by: Corydon76
Patches: 
      2007092900_10843.diff uploaded by mvanbaak (license 7)

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

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
10-01-07 10:04  svnbot         Checkin                                      
10-01-07 10:04  svnbot         Note Added: 0071251                          
10-01-07 10:04  svnbot         Assigned To               => russell         
======================================================================




More information about the asterisk-bugs mailing list