From: Victor Julien Date: Sun, 2 Mar 2014 09:27:43 +0000 (+0100) Subject: ssh: fixes for minor scan-build warnings X-Git-Tag: suricata-2.0rc2~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=669b351dad25f48e26ad9e90c7a0416fdb9bf425;p=thirdparty%2Fsuricata.git ssh: fixes for minor scan-build warnings /usr/share/clang/scan-build/ccc-analyzer -DHAVE_CONFIG_H -I. -I.. -I./../libhtp/ -I/usr/include/nspr -I/usr/include/nss -I/usr/include/nspr -DLOCAL_STATE_DIR=\"/usr/local/var\" -g -O2 -Wall -Wno-unused-parameter -std=gnu99 -DHAVE_LIBNET11 -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -DHAVE_LIBNET_ICMPV6_UNREACH -I/usr/include -DLIBPCAP_VERSION_MAJOR=1 -DHAVE_PCAP_SET_BUFF -DHAVE_LIBCAP_NG -DREVISION="51e0dee" -MT app-layer-ssh.o -MD -MP -MF .deps/app-layer-ssh.Tpo -c -o app-layer-ssh.o app-layer-ssh.c app-layer-ssh.c:164:5: warning: Value stored to 'input' is never read input += 1; ^ ~ app-layer-ssh.c:165:5: warning: Value stored to 'input_len' is never read input_len -= 1; ^ ~ app-layer-ssh.c:212:13: warning: Value stored to 'ret' is never read ret = 0; ^ ~ 3 warnings generated. --- diff --git a/src/app-layer-ssh.c b/src/app-layer-ssh.c index ad8d588d70..775f8006fc 100644 --- a/src/app-layer-ssh.c +++ b/src/app-layer-ssh.c @@ -131,7 +131,8 @@ static int SSHParseBanner(SshState *state, SshHeader *header, const uint8_t *inp SCReturnInt(len); } -static int SSHParseRecordHeader(SshState *state, SshHeader *header, uint8_t *input, uint32_t input_len) +static int SSHParseRecordHeader(SshState *state, SshHeader *header, + const uint8_t *input, uint32_t input_len) { #ifdef DEBUG BUG_ON(input_len != 6); @@ -163,9 +164,6 @@ static int SSHParseRecordHeader(SshState *state, SshHeader *header, uint8_t *inp header->msg_code = *input; - input += 1; - input_len -= 1; - SCLogDebug("msg code: %u", header->msg_code); if (header->msg_code == SSH_MSG_NEWKEYS) { @@ -211,7 +209,6 @@ static int SSHParseRecord(SshState *state, SshHeader *header, uint8_t *input, ui SCLogDebug("Version string parsed, remaining length %d", ret); input += input_len - ret; input_len -= (input_len - ret); - ret = 0; uint32_t u = 0; while (u < input_len && (input[u] == '\r' || input[u] == '\n')) {