diff --git a/src/app-layer-detect-proto.c b/src/app-layer-detect-proto.c index a5d4a2886a..c1ae2a70c0 100644 --- a/src/app-layer-detect-proto.c +++ b/src/app-layer-detect-proto.c @@ -526,7 +526,7 @@ end: if (mpm_table[dir->mpm_ctx.mpm_type].Cleanup != NULL) { mpm_table[dir->mpm_ctx.mpm_type].Cleanup(&tdir->mpm_ctx); } -#if 1 +#if 0 printf("AppLayerDetectGetProto: returning %" PRIu16 " (%s): ", proto, flags & STREAM_TOCLIENT ? "TOCLIENT" : "TOSERVER"); switch (proto) { case ALPROTO_HTTP: diff --git a/src/app-layer-ssh.c b/src/app-layer-ssh.c index de565d1754..a3c2e9a6a7 100644 --- a/src/app-layer-ssh.c +++ b/src/app-layer-ssh.c @@ -153,7 +153,7 @@ static int SSHParseServerVersion(Flow *f, void *ssh_state, AppLayerParserState * SCReturnInt(-1); } - uint64_t proto_ver_len = (uint64_t)((uint64_t)proto_end - (uint64_t)line_ptr); + uint64_t proto_ver_len = (uint64_t)(proto_end - line_ptr); state->server_proto_version = SCMalloc(proto_ver_len + 1); if (state->server_proto_version == NULL) { SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory"); @@ -180,7 +180,7 @@ static int SSHParseServerVersion(Flow *f, void *ssh_state, AppLayerParserState * } } - uint64_t sw_ver_len = (uint64_t)((uint64_t)sw_end - (uint64_t)line_ptr); + uint64_t sw_ver_len = (uint64_t)(sw_end - line_ptr); state->server_software_version = SCMalloc(sw_ver_len + 1); if (state->server_software_version == NULL) { SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory"); @@ -486,7 +486,7 @@ static int SSHParseClientVersion(Flow *f, void *ssh_state, AppLayerParserState * SCReturnInt(-1); } - uint64_t proto_ver_len = (uint64_t)((uint64_t)proto_end - (uint64_t)line_ptr); + uint64_t proto_ver_len = (uint64_t)(proto_end - line_ptr); state->client_proto_version = SCMalloc(proto_ver_len + 1); if (state->client_proto_version == NULL) { SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory"); @@ -513,7 +513,7 @@ static int SSHParseClientVersion(Flow *f, void *ssh_state, AppLayerParserState * } } - uint64_t sw_ver_len = (uint64_t)((uint64_t)sw_end - (uint64_t)line_ptr); + uint64_t sw_ver_len = (uint64_t)(sw_end - line_ptr); state->client_software_version = SCMalloc(sw_ver_len + 1); if (state->client_software_version == NULL) { SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory"); @@ -732,7 +732,7 @@ static void *SSHStateAlloc(void) */ static void SSHStateFree(void *state) { - SshState *s= (SshState *)state; + SshState *s = (SshState *)state; if (s->client_proto_version != NULL) SCFree(s->client_proto_version); if (s->client_software_version != NULL) diff --git a/src/detect-ssh-proto-version.c b/src/detect-ssh-proto-version.c index eb778b2ab1..d7a4989d9b 100644 --- a/src/detect-ssh-proto-version.c +++ b/src/detect-ssh-proto-version.c @@ -190,6 +190,8 @@ DetectSshVersionData *DetectSshVersionParse (char *str) if (ssh == NULL) goto error; + memset(ssh, 0x00, sizeof(DetectSshVersionData)); + /* If we expect a protocol version 2 or 1.99 (considered 2, we * will compare it with both strings) */ if (strcmp("2_compat", str_ptr) == 0) { @@ -233,7 +235,8 @@ static int DetectSshVersionSetup (DetectEngineCtx *de_ctx, Signature *s, char *s SigMatch *sm = NULL; ssh = DetectSshVersionParse(str); - if (ssh == NULL) goto error; + if (ssh == NULL) + goto error; /* Okay so far so good, lets get this into a SigMatch * and put it in the Signature. */ @@ -255,8 +258,10 @@ static int DetectSshVersionSetup (DetectEngineCtx *de_ctx, Signature *s, char *s return 0; error: - if (ssh != NULL) DetectSshVersionFree(ssh); - if (sm != NULL) SCFree(sm); + if (ssh != NULL) + DetectSshVersionFree(ssh); + if (sm != NULL) + SCFree(sm); return -1; } diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index 746ec8dd36..b9d1e6a759 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -1527,8 +1527,6 @@ int StreamTcpReassembleHandleSegmentUpdateACK (TcpReassemblyThreadCtx *ra_ctx, if (!(ssn->flags & STREAMTCP_FLAG_TOSERVER_REASSEMBLY_STARTED)) { SCLogDebug("toserver reassembling is not done yet, so " "skipping reassembling at the moment for to_client"); - printf("toserver reassembling is not done yet, so " - "skipping reassembling at the moment for to_client\n"); SCReturnInt(0); } }