[Forensics-changes] [yara] 341/415: Limit the number of printed bytes while printing matching strings

Hilko Bengen bengen at moszumanska.debian.org
Thu Apr 3 05:43:22 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch debian
in repository yara.

commit 85173abfaec17dc777b3d57fef186bc94d68853a
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Mon Dec 23 14:50:08 2013 +0100

    Limit the number of printed bytes while printing matching strings
---
 yara.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/yara.c b/yara.c
index 8c85079..f2d78ce 100644
--- a/yara.c
+++ b/yara.c
@@ -72,6 +72,10 @@ limitations under the License.
 #define MAX_PATH 255
 #endif
 
+#ifndef min
+#define min(x, y)  ((x < y) ? (x) : (y))
+#endif
+
 #ifdef _MSC_VER
 #define snprintf _snprintf
 #define strdup _strdup
@@ -356,9 +360,12 @@ void print_hex_string(
 {
   int i;
 
-  for (i = 0; i < length; i++)
+  for (i = 0; i < min(32, length); i++)
     printf("%02X ", (uint8_t) data[i]);
 
+  if (length > 32)
+    printf("...");
+
   printf("\n");
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list