[asterisk-bugs] [Asterisk 0018640]: [patch] Potential malfunction due to unitialized local variable

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Jan 19 09:45:19 CST 2011


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=18640 
====================================================================== 
Reported By:                jcovert
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   18640
Category:                   Channels/chan_sip/General
Reproducibility:            random
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           SVN 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): 1.8 
SVN Revision (number only!): 302314 
Request Review:              
====================================================================== 
Date Submitted:             2011-01-18 19:39 CST
Last Modified:              2011-01-19 09:45 CST
====================================================================== 
Summary:                    [patch] Potential malfunction due to unitialized
local variable
Description: 
The compiler correctly reports:

In function 'parse_register_contact':
'single_binding_found' may be used uninitialized

Upon inspection, if (!strcasecmp(curi, "*")) we will set wildcard = 1 and
single_binding_found will have a random value, since initialization of
local variables is undefined.

At the next line:

if (wildcard_found && (ast_strlen_zero(expires) || expire != 0 ||
single_binding_found))

we now test single binding found in an "or", and the result will be
random.

A patch to 1.8 head is provided.
====================================================================== 

---------------------------------------------------------------------- 
 (0130677) svnbot (reporter) - 2011-01-19 09:45
 https://issues.asterisk.org/view.php?id=18640#c130677 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 302414

U   branches/1.8/channels/chan_sip.c

------------------------------------------------------------------------
r302414 | seanbright | 2011-01-19 09:45:18 -0600 (Wed, 19 Jan 2011) | 7
lines

Initialize an uninitialied variable.

(closes issue https://issues.asterisk.org/view.php?id=18640)
Reported by: jcovert
Patches:
      chan_sip.c.patch uploaded by jcovert (license 551)

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

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-01-19 09:45 svnbot         Checkin                                      
2011-01-19 09:45 svnbot         Note Added: 0130677                          
======================================================================




More information about the asterisk-bugs mailing list