From 2ef2a35be436b7b82e61a5329db08cad446b9532 Mon Sep 17 00:00:00 2001 From: Francis Rowe Date: Mon, 22 Dec 2014 14:53:11 +0000 Subject: ich9deblob: fail on big endian systems --- resources/utilities/ich9deblob/ich9deblob.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'resources/utilities/ich9deblob/ich9deblob.c') diff --git a/resources/utilities/ich9deblob/ich9deblob.c b/resources/utilities/ich9deblob/ich9deblob.c index 3fb72409..c12f758a 100644 --- a/resources/utilities/ich9deblob/ich9deblob.c +++ b/resources/utilities/ich9deblob/ich9deblob.c @@ -87,6 +87,14 @@ int main(int argc, char *argv[]) return 1; } + // endianness check. big endian forced to fail + unsigned short steak = 0xBEEF; + unsigned char *grill = (char*)&steak; + if (*grill==0xBE) { + printf("\nunsigned short 0xBEEF: first byte should be EF, but it's BE. Your system is big endian, and unsupported (only little endian is tested)\n"); + return 1; + } + // ----------------------------------------------------------------------------------------------- // files that this utility will handle -- cgit v1.2.3-70-g09d2