Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-bugs: [Wireshark-bugs] [Bug 2812] Uninitialized variables (Lint Warning 603)

Date: Thu, 23 Oct 2008 01:57:22 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2812





--- Comment #1 from Stephen Fisher <stephentfisher@xxxxxxxxx>  2008-10-23 01:57:18 PDT ---

(In reply to comment #0)
> SVN 26033

> I ran lint on *.c, epan/*.c, epan/dissectors/packet-*.c, and
> plugins/*/packet-*.c and the following files were identified by lint as having
> uninitialized variables.

Thanks as always for your help, Chris!

> 1) packet-acn.c(528): Warning 603: Symbol 'addr' (line 468) not initialized

This has since moved to line 465 as of svn rev 26280.

(Thinking out loud to understand it myself...) The variable addr is only set
using the SET_ADDRESS() macro in two of the three case statements before being
used in a call to proto_item_append_text().  The third case statement
(ACN_ADDR_IPPORT) uses it in a call to address_to_str(), which in turn passes
the value to address_to_str_buf() before initializing it.  This must be what
lint is complaining about.  Simply initializing it to NULL in the declaration
won't help matters because address_to_str_buf() will not be happy when
addr->type is used in a switch statement.  It looks like our goal here is to
keep it from being used before initializing it to something useful.

I don't know why address_to_str(&addr) is even being used in the third case
because it is case ACN_ADDR_IPPORT and should probably only display the port
instead IP & port.  Anyone familiar with this dissector to know for sure?  If
not, I can just make an educated guess and change it to avoid potential crashes
if/when that code is reached.

> 2) packet-dnp.c(1560) : Warning 603: Symbol 'al_cto' (line 1255) not
> initialized

This looks like another case of using the variable in a case statement without
initializing it first while using it in another case statement that does
initialize it first.

> 3) packet-lapd.c(284) : Warning 603: Symbol 'data' (line 215) not initialized
> 4) randpkt.c(544) : Warning 603: Symbol 'ps_header' (line 444) not initialized

Chris, are you coming to the same conclusions that I am for #1 and #2?  I
haven't looked at #3 or #4 yet, but they're probably quite similar.

I better not make any changes to the svn trunk right now as it's the middle of
the night and I'm tired :).  


-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.