[Forensics-changes] [yara] 192/192: Move variable declaration to beginning of block

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:32:05 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 0dfe1e8fa2db7cbcef01d398943ec7730071ba84
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Mon May 22 12:24:23 2017 +0200

    Move variable declaration to beginning of block
---
 libyara/modules/pe.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/libyara/modules/pe.c b/libyara/modules/pe.c
index 634515f..16c467e 100644
--- a/libyara/modules/pe.c
+++ b/libyara/modules/pe.c
@@ -1205,6 +1205,9 @@ void pe_parse_certificates(
 
           if (serial_der != NULL)
           {
+            unsigned char* serial_bytes;
+            char *serial_ascii;
+
             bytes = i2d_ASN1_INTEGER(serial, &serial_der);
 
             // i2d_ASN1_INTEGER() moves the pointer as it writes into
@@ -1213,7 +1216,7 @@ void pe_parse_certificates(
             serial_der -= bytes;
 
             // Skip over DER type, length information
-            unsigned char* serial_bytes = serial_der + 2;
+            serial_bytes = serial_der + 2;
             bytes -= 2;
 
             // Also allocate space to hold the "common" string format:
@@ -1224,7 +1227,7 @@ void pe_parse_certificates(
             // The last one doesn't have the colon, but the extra byte is used
             // for the NULL terminator.
 
-            char *serial_ascii = (char*) yr_malloc(bytes * 3);
+            serial_ascii = (char*) yr_malloc(bytes * 3);
 
             if (serial_ascii)
             {
@@ -1235,14 +1238,14 @@ void pe_parse_certificates(
                 // Don't put the colon on the last one.
                 if (j < bytes - 1)
                   snprintf(
-                    (char*) serial_ascii + 3 * j, 4, "%02x:", serial_bytes[j]);
+                    serial_ascii + 3 * j, 4, "%02x:", serial_bytes[j]);
                 else
                   snprintf(
-                    (char*) serial_ascii + 3 * j, 3, "%02x", serial_bytes[j]);
+                    serial_ascii + 3 * j, 3, "%02x", serial_bytes[j]);
               }
 
               set_string(
-                  (char*) serial_ascii,
+                  serial_ascii,
                   pe->object,
                   "signatures[%i].serial",
                   counter);

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