Wireshark mailing list archives

Re: [Wireshark-commits] rev 47188: /trunk/ui/gtk/ /trunk/ui/gtk/: main.c


From: Jaap Keuter <jaap.keuter () xs4all nl>
Date: Mon, 21 Jan 2013 08:04:50 +0100

Hi,

I think I have been staring at line 2895 too long. Since I didn't have  Coverity
at my disposal this weekend I tried to take a stab at it, but couldn't verify
it. It looks like a strange construction anyway.
prefs_p = read_configuration_files (&gdp_path, &dp_path); is what makes it work,
but Coverity doesn't pick up on that. We may as well rewrite this bit.

Thanks,
Jaap

On 01/20/2013 11:14 PM, Guy Harris wrote:

On Jan 20, 2013, at 1:45 PM, jake () wireshark org wrote:

http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=47188

User: jake
Date: 2013/01/20 01:45 PM

Log:
Fix for CID 715142.
Be aware that the short-circuit evaluation only applies to the 
first operand of a logical AND expression.

...but if the second operand is itself a logical AND expression, short-circuit evaluation applies to the first 
operand of *that* expression.  I'm not sure what that change actually changes; would not both evaluate as

      if global_capture_opts.num_selected == 0
      then
              if prefs.capture_device != NULL
              then
                      if *prefs_p->capture_device != '\0'
                      then
                              TRUE
                      else
                              FALSE
              else
                      FALSE
      else
              FALSE

(expression syntax is C syntax, if/then syntax isn't)?

At least when I look at 715142, I think the problem about which it's complaining is that, unless prefs_p == &prefs, 
establishing that prefs.capture_devices != NULL does nothing to establish that prefs_p->capture_devices is != NULL, 
and therefore does nothing to establish that *prefs_p->capture_device is a valid reference.



___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: