Wireshark-bugs: [Wireshark-bugs] [Bug 4393] Error when compiling due to uninitialized variables

Date: Wed, 13 Jan 2010 17:21:25 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4393

--- Comment #7 from Stephen Fisher <steve@xxxxxxxxxxxxxxxxxx> 2010-01-13 18:21:23 MST ---
That dissector is in the "clean source" part of Makefile.common, meaning that
it will run with -Werror since it shouldn't produce these warnings.  However,
with a quick look at the code, I can see why it's complaining (only relevant
portions of the code shown from function dissect_secchan_verf):

  guint64 encrypted_seq;
  guint64 digest;
  guint64 confounder;

  if(  ! (seen.isseen && seen.num == pinfo->fd->num) ) {

    offset = dissect_dcerpc_8bytes(tvb, offset, pinfo, subtree, drep,
              hf_netlogon_secchan_verf_seq, &encrypted_seq);

    offset = dissect_dcerpc_8bytes(tvb, offset, pinfo, subtree, drep,
              hf_netlogon_secchan_verf_digest, &digest);

    if (tvb_bytes_exist(tvb, offset, 8)) {
        offset = dissect_dcerpc_8bytes(tvb, offset, pinfo, subtree, drep,
                   hf_netlogon_secchan_verf_nonce, &confounder);
    }
  }

      if(update_vars) {
        vars->confounder = confounder;
        vars->seq =
uncrypt_sequence(vars->session_key,digest,encrypted_seq,is_server);
      }

It must be complaining because it is possible for the first block of code
within the first if() statement may not run to set these variables, while the
second block within the second if() could, which uses them.

The attached patch will probably do the trick without ramifications, or a
different value may work to set the variables to might be better.  Refactoring
may even be the best fix.

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