[Forensics-changes] [yara] 58/192: Minor re-styling

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:31:46 UTC 2017


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

bengen pushed a commit to annotated tag v3.6.0
in repository yara.

commit 0b3d9a93276d3364b2a3561995d27e8b4a137134
Author: plusvic <plusvic at gmail.com>
Date:   Mon Oct 31 09:48:53 2016 +0100

    Minor re-styling
---
 tests/test-exception.c | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/tests/test-exception.c b/tests/test-exception.c
index 19dc911..8ebea58 100644
--- a/tests/test-exception.c
+++ b/tests/test-exception.c
@@ -48,29 +48,38 @@ int main(int argc, char **argv)
     perror("Create temp file");
     return 77;
   }
+
   unlink(filename);
 
   memset(wbuf, 'a', sizeof(wbuf));
-  for (i=0; i<=3; i++)
+
+  for (i = 0; i <= 3; i++)
     write(fd, wbuf, sizeof(wbuf));
 
-  uint8_t* mapped_region = mmap(NULL, 4*sizeof(wbuf), PROT_READ, MAP_SHARED, fd, 0);
-  ftruncate(fd, 2*sizeof(wbuf));
+  uint8_t* mapped_region = mmap(
+      NULL, 4 * sizeof(wbuf), PROT_READ, MAP_SHARED, fd, 0);
+
+  ftruncate(fd, 2 * sizeof(wbuf));
+
   /*
     mapped_region is now only partially backed by the open file
     referred to by fd. Accessing the memory beyond
 
-        mapped_region + 2*sizeof(wbuf)
+        mapped_region + 2 * sizeof(wbuf)
 
     causes SIGBUS to be raised.
   */
 
   yr_initialize();
 
-  YR_RULES* rules_a = compile_rule("rule test { strings: $a = \"aaaa\" condition: all of them }");
-  YR_RULES* rules_0 = compile_rule("rule test { strings: $a = { 00 00 00 00 } condition: all of them }");
+  YR_RULES* rules_a = compile_rule(
+      "rule test { strings: $a = \"aaaa\" condition: all of them }");
+
+  YR_RULES* rules_0 = compile_rule(
+      "rule test { strings: $a = { 00 00 00 00 } condition: all of them }");
 
   puts("Scanning for \"aaaa\"...");
+
   int matches = 0;
 
   /*
@@ -80,12 +89,17 @@ int main(int argc, char **argv)
 
     yr_rules_scan_mem() will terminate the process.
   */
-  int rc = yr_rules_scan_mem(rules_a, mapped_region, 4*sizeof(wbuf), 0, count_matches, &matches, 0);
+
+  int rc = yr_rules_scan_mem(
+      rules_a, mapped_region, 4 * sizeof(wbuf), 0, count_matches, &matches, 0);
+
   printf("err = %d, matches = %d\n", rc, matches);
+
   if (rc == ERROR_SUCCESS || matches != 0)
     return 1;
 
   puts("Sending blocked SIGUSR1 to ourselves...");
+
   sigset_t set;
   sigemptyset(&set);
   sigaddset(&set, SIGUSR1);
@@ -99,8 +113,12 @@ int main(int argc, char **argv)
     This tests that SIGUSR1 is not delivered when setting up SIGBUS
     signal handling -- or during SIGBUS signal handling
   */
-  rc = yr_rules_scan_mem(rules_0, mapped_region, 4*sizeof(wbuf), 0, count_matches, &matches, 0);
+
+  rc = yr_rules_scan_mem(
+      rules_0, mapped_region, 4 * sizeof(wbuf), 0, count_matches, &matches, 0);
+
   printf("err = %d, matches = %d\n", rc, matches);
+
   if (rc == ERROR_SUCCESS || matches != 0)
     return 1;
 

-- 
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