[Forensics-changes] [yara] 96/192: Put loop variable declaration out of the “for” statement as required by C89.

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:31:51 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 9a12a825846e1047916d03ec22f4768940dd95a0
Author: plusvic <plusvic at gmail.com>
Date:   Fri Jan 27 15:14:19 2017 +0100

    Put loop variable declaration out of the “for” statement as required by C89.
---
 libyara/modules/pe.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libyara/modules/pe.c b/libyara/modules/pe.c
index 24c39b3..8ef646c 100644
--- a/libyara/modules/pe.c
+++ b/libyara/modules/pe.c
@@ -995,9 +995,9 @@ void pe_parse_certificates(
     if (yr_le16toh(win_cert->Revision) != WIN_CERT_REVISION_2_0 ||
         yr_le16toh(win_cert->CertificateType) != WIN_CERT_TYPE_PKCS_SIGNED_DATA)
     {
-      uintptr_t end = (uintptr_t) 
+      uintptr_t end = (uintptr_t)
           ((uint8_t *) win_cert) + yr_le32toh(win_cert->Length);
-      
+
       win_cert = (PWIN_CERTIFICATE) (end + (end % 8));
       continue;
     }
@@ -1870,13 +1870,15 @@ define_function(calculate_checksum)
   uint64_t csum = 0;
   size_t csum_offset;
 
+  int i, j;
+
   if (pe == NULL)
     return_integer(UNDEFINED);
 
   csum_offset = ((uint8_t*) &(pe->header->OptionalHeader) +
       offsetof(IMAGE_OPTIONAL_HEADER32, CheckSum)) - pe->data;
 
-  for (int i = 0; i <= pe->data_size / 4; i++)
+  for (i = 0; i <= pe->data_size / 4; i++)
   {
     // Treat the CheckSum field as 0 -- the offset is the same for
     // PE32 and PE64.
@@ -1893,7 +1895,7 @@ define_function(calculate_checksum)
     }
     else
     {
-      for (int j = 0; j < pe->data_size % 4; j++)
+      for (j = 0; j < pe->data_size % 4; j++)
         csum += (uint64_t) pe->data[4 * i + j] << (8 * j);
     }
 

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