[Forensics-changes] [yara] 108/407: Replace htonl with bigendian macro
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:28:15 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.3.0
in repository yara.
commit 561f61eaaab7d72cc32075bae0e78884bf86d0f9
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Tue Oct 14 17:43:33 2014 +0200
Replace htonl with bigendian macro
This way we don't need to include arpa/inet.h or winsock2.h.
---
libyara/modules/pe.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/libyara/modules/pe.c b/libyara/modules/pe.c
index 7feeb44..7518b42 100644
--- a/libyara/modules/pe.c
+++ b/libyara/modules/pe.c
@@ -24,6 +24,13 @@ limitations under the License.
#include <yara/strutils.h>
+#define bigendian(n) \
+ (((((uint32_t)(n) & 0xFF)) << 24) | \
+ ((((uint32_t)(n) & 0xFF00)) << 8) | \
+ ((((uint32_t)(n) & 0xFF0000)) >> 8) | \
+ ((((uint32_t)(n) & 0xFF000000)) >> 24))
+
+
#define MODULE_NAME pe
#define RESOURCE_TYPE_CURSOR 1
@@ -1800,8 +1807,8 @@ void *pe_get_rich_signature(
return NULL;
memcpy(raw_data, rich_signature, rich_len);
- set_integer(htonl(rich_signature->dans), pe_obj, "rich_signature.start");
- set_integer(htonl(rich_signature->key1), pe_obj, "rich_signature.key");
+ set_integer(bigendian(rich_signature->dans), pe_obj, "rich_signature.start");
+ set_integer(bigendian(rich_signature->key1), pe_obj, "rich_signature.key");
break;
}
}
--
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