detect-tls: check return values of functions on setup

Check the return values of DetectBufferSetActiveList() and
DetectSignatureSetAppProto().
pull/3868/head
Mats Klepsland 6 years ago committed by Victor Julien
parent 1c04d7cdae
commit 0f7f35bd85

@ -110,14 +110,16 @@ void DetectTlsFingerprintRegister(void)
* \param s Pointer to the Signature to which the current keyword belongs
* \param str Should hold an empty string always
*
* \retval 0 On success
* \retval 0 On success
* \retval -1 On failure
*/
static int DetectTlsFingerprintSetup(DetectEngineCtx *de_ctx, Signature *s,
const char *str)
{
DetectBufferSetActiveList(s, g_tls_cert_fingerprint_buffer_id);
if (DetectBufferSetActiveList(s, g_tls_cert_fingerprint_buffer_id) < 0)
return -1;
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) != 0)
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) < 0)
return -1;
return 0;

@ -101,12 +101,17 @@ void DetectTlsIssuerRegister(void)
* \param s Pointer to the Signature to which the current keyword belongs
* \param str Should hold an empty string always
*
* \retval 0 On success
* \retval 0 On success
* \retval -1 On failure
*/
static int DetectTlsIssuerSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
{
DetectBufferSetActiveList(s, g_tls_cert_issuer_buffer_id);
s->alproto = ALPROTO_TLS;
if (DetectBufferSetActiveList(s, g_tls_cert_issuer_buffer_id) < 0)
return -1;
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) < 0)
return -1;
return 0;
}

@ -110,13 +110,15 @@ void DetectTlsSerialRegister(void)
* \param s Pointer to the Signature to which the current keyword belongs
* \param str Should hold an empty string always
*
* \retval 0 On success
* \retval 0 On success
* \retval -1 On failure
*/
static int DetectTlsSerialSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
{
DetectBufferSetActiveList(s, g_tls_cert_serial_buffer_id);
if (DetectBufferSetActiveList(s, g_tls_cert_serial_buffer_id) < 0)
return -1;
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) != 0)
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) < 0)
return -1;
return 0;

@ -100,12 +100,17 @@ void DetectTlsSubjectRegister(void)
* \param s Pointer to the Signature to which the current keyword belongs
* \param str Should hold an empty string always
*
* \retval 0 On success
* \retval 0 On success
* \retval -1 On failure
*/
static int DetectTlsSubjectSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
{
DetectBufferSetActiveList(s, g_tls_cert_subject_buffer_id);
s->alproto = ALPROTO_TLS;
if (DetectBufferSetActiveList(s, g_tls_cert_subject_buffer_id) < 0)
return -1;
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) < 0)
return -1;
return 0;
}

@ -111,12 +111,16 @@ void DetectTlsJa3HashRegister(void)
* \param s Pointer to the Signature to which the current keyword belongs
* \param str Should hold an empty string always
*
* \retval 0 On success
* \retval 0 On success
* \retval -1 On failure
*/
static int DetectTlsJa3HashSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
{
DetectBufferSetActiveList(s, g_tls_ja3_hash_buffer_id);
s->alproto = ALPROTO_TLS;
if (DetectBufferSetActiveList(s, g_tls_ja3_hash_buffer_id) < 0)
return -1;
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) < 0)
return -1;
if (RunmodeIsUnittests())
return 0;

@ -101,12 +101,16 @@ void DetectTlsJa3StringRegister(void)
* \param s Pointer to the Signature to which the current keyword belongs
* \param str Should hold an empty string always
*
* \retval 0 On success
* \retval 0 On success
* \retval -1 On failure
*/
static int DetectTlsJa3StringSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
{
DetectBufferSetActiveList(s, g_tls_ja3_str_buffer_id);
s->alproto = ALPROTO_TLS;
if (DetectBufferSetActiveList(s, g_tls_ja3_str_buffer_id) < 0)
return -1;
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) < 0)
return -1;
if (RunmodeIsUnittests())
return 0;

@ -99,12 +99,17 @@ void DetectTlsSniRegister(void)
* \param s Pointer to the Signature to which the current keyword belongs
* \param str Should hold an empty string always
*
* \retval 0 On success
* \retval 0 On success
* \retval -1 On failure
*/
static int DetectTlsSniSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
{
DetectBufferSetActiveList(s, g_tls_sni_buffer_id);
s->alproto = ALPROTO_TLS;
if (DetectBufferSetActiveList(s, g_tls_sni_buffer_id) < 0)
return -1;
if (DetectSignatureSetAppProto(s, ALPROTO_TLS) < 0)
return -1;
return 0;
}

Loading…
Cancel
Save