From: Anoop Saldanha Date: Fri, 4 May 2012 08:36:01 +0000 (+0530) Subject: Add a nice error message when we exceeded address buffer limit for a rule X-Git-Tag: suricata-1.3beta2~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d39b7b72bdb00fcd3a62878a37524e54e4ebdfe5;p=thirdparty%2Fsuricata.git Add a nice error message when we exceeded address buffer limit for a rule --- diff --git a/src/detect-engine-address.c b/src/detect-engine-address.c index 2a73235840..cbcde7b458 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 0ca3d41dea..b70c934d15 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);