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

Wireshark-dev: [Wireshark-dev] missing break in packet-ssl.c

From: Kaul <mykaul@xxxxxxxxx>
Date: Sun, 9 May 2010 23:37:40 +0300
I began fixing packet-ssl.c a bit, according to the clang analyzer output and one of its warnings was alarming:
In ssl_looks_like_valid_pct_handshake(), it appears there's a missing break:

case PCT_MSG_CLIENT_HELLO0x01:
3907 /* version follows msg byte, so verify that this is valid */
3908 version = tvb_get_ntohs(tvb, offset+1);
3909 ret = (version == PCT_VERSION_10x8001);

Value stored to 'ret' is never read
3910
3911 case PCT_MSG_SERVER_HELLO0x02:
3912 /* version is one byte after msg_type */
3913 version = tvb_get_ntohs(tvb, offset+2);
3914 ret = (version == PCT_VERSION_10x8001);
3915
3916 case PCT_MSG_CLIENT_MASTER_KEY0x03:
...


Well, clang is right - but I guess that's because a break is missing in line 3910 - and in line 3915!
Am I correct?
Apart from that, I've fixed numerous dead assignments and dead increments in packet-ssl.c, and only 3 bugs exist (the above included).
Please see attached diff (which also has some const of params in it, done on the way).
Y.

Attachment: packet-ssl.c.clang.diff
Description: Binary data