[Home]

Summary:ASTERISK-04759: vasprintf in utils.c does not implement correct semantics on Solaris
Reporter:drach (drach)Labels:
Date Opened:2005-08-02 17:33:29Date Closed:2008-01-15 15:43:21.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) vasprintf.patch
Description:vasprintf in utils.c rev 1.61 has several bugs that prevent compilation and implementation of correct semantics on Solaris (9/10 and x86/sparc):

1) vsnprintf is called with a 0 argument for the count,  In Solaris versions 9 and below, the return value is a negative integer in accordance with SUSv2 (Single Unix Specification), and, in Solaris 10, the number of characters needed in accordance with SUSv3.

2) The second instance of vsnprintf is surrounded by calls to va_start and va_end which are surrounding the calls to vasprintf in cli.c and res-agi.c.  In
addition, this prevents the function from compiling.

3) There is a memory leak in which *strp is assigned a malloced array but it is not freed.

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

I've compiled and tested the attached patch on Solaris 9 sparc and Solaris 10 x86.
Comments:By: Mark Spencer (markster) 2005-08-02 22:03:21

Fixed in CVS head, thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:43:21.000-0600

Repository: asterisk
Revision: 6258

U   trunk/utils.c

------------------------------------------------------------------------
r6258 | markster | 2008-01-15 15:43:21 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix vasnprintf emulation (bug ASTERISK-4759)

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

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