]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Add a nice error message when we exceeded address buffer limit for a rule
authorAnoop Saldanha <poonaatsoc@gmail.com>
Fri, 4 May 2012 08:36:01 +0000 (14:06 +0530)
committerVictor Julien <victor@inliniac.net>
Wed, 16 May 2012 12:10:11 +0000 (14:10 +0200)
src/detect-engine-address.c
src/util-error.c

index 2a732358406d369e8f3af8b9d115405dc9c185ea..cbcde7b458e39f8dace6214f03f90ad5d178509e 100644 (file)
@@ -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++;
 
index 0ca3d41dea91de248368bd89a107780527823e46..b70c934d152df38c2638ba7a0d057e32a4f4e96f 100644 (file)
@@ -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);