From 29b13a928d6a3eea160f4801ee942b6a610deb29 Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Fri, 4 May 2012 14:06:01 +0530 Subject: [PATCH 2/2] Add a nice error message when we exceeded address buffer limit for a rule --- src/detect-engine-address.c | 6 ++++++ src/util-error.c | 1 + 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/detect-engine-address.c b/src/detect-engine-address.c index 12a1f83..c8719e9 100644 --- a/src/detect-engine-address.c +++ b/src/detect-engine-address.c @@ -926,6 +926,12 @@ int DetectAddressParse2(DetectAddressHead *gh, DetectAddressHead *ghn, char *s, SCLogDebug("s %s negate %s", s, negate ? "true" : "false"); for (u = 0, x = 0; u < size && x < sizeof(address); u++) { + if (x == (sizeof(address) - 1)) { + SCLogError(SC_ERR_ADDRESS_ENGINE_GENERIC, "Hit the address buffer" + " limit for the supplied address. Invalidating sig. " + "Please file a bug report on this."); + goto error; + } address[x] = s[u]; x++; diff --git a/src/util-error.c b/src/util-error.c index 0ca3d41..b70c934 100644 --- a/src/util-error.c +++ b/src/util-error.c @@ -100,6 +100,7 @@ const char * SCErrorToString(SCError err) CASE_CODE (SC_ERR_POOL_INIT); CASE_CODE (SC_ERR_UNIMPLEMENTED); CASE_CODE (SC_ERR_FAST_LOG_GENERIC); + CASE_CODE (SC_ERR_ADDRESS_ENGINE_GENERIC); CASE_CODE (SC_ERR_IPONLY_RADIX); CASE_CODE (SC_ERR_DEBUG_LOG_GENERIC); CASE_CODE (SC_ERR_UNIFIED_LOG_GENERIC); -- 1.7.1