Skip to content

Commit

Permalink
Merge pull request #5 from zeroSteiner/fix/compiler-warnings
Browse files Browse the repository at this point in the history
Fix compiler warnings
  • Loading branch information
kev169 authored Sep 9, 2022
2 parents d69bc13 + 61e8097 commit 24da168
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
12 changes: 6 additions & 6 deletions COFFLoader.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
unsigned char* unhexlify(unsigned char* value, int *outlen) {
unsigned char* retval = NULL;
char byteval[3] = { 0 };
int counter = 0;
unsigned int counter = 0;
int counter2 = 0;
char character = 0;
if (value == NULL) {
Expand All @@ -55,7 +55,7 @@ unsigned char* unhexlify(unsigned char* value, int *outlen) {
counter2 = 0;
for (counter = 0; counter < strlen((char*)value); counter += 2) {
memcpy(byteval, value + counter, 2);
character = strtol(byteval, NULL, 16);
character = (char)strtol(byteval, NULL, 16);
memcpy(retval + counter2, &character, 1);
counter2++;
}
Expand All @@ -73,7 +73,7 @@ unsigned char* unhexlify(unsigned char* value, int *outlen) {
unsigned char* getContents(char* filepath, uint32_t* outsize) {
FILE *fin = NULL;
uint32_t fsize = 0;
uint32_t readsize = 0;
size_t readsize = 0;
unsigned char* buffer = NULL;
unsigned char* tempbuffer = NULL;

Expand Down Expand Up @@ -168,11 +168,11 @@ int RunCOFF(char* functionname, unsigned char* coff_data, uint32_t filesize, uns
int retcode = 0;
int counter = 0;
int reloccount = 0;
int tempcounter = 0;
unsigned int tempcounter = 0;
uint32_t symptr = 0;
#ifdef _WIN32
void* funcptrlocation = NULL;
int32_t offsetvalue = 0;
size_t offsetvalue = 0;
#endif
char* entryfuncname = functionname;
#if defined(__x86_64__) || defined(_WIN64)
Expand Down Expand Up @@ -411,7 +411,7 @@ int RunCOFF(char* functionname, unsigned char* coff_data, uint32_t filesize, uns
#ifdef _WIN32
/* So for some reason VS 2017 doesn't like this, but char* casting works, so just going to do that */
#ifdef _MSC_VER
foo = (char*)(sectionMapping[coff_sym_ptr[tempcounter].SectionNumber - 1] + coff_sym_ptr[tempcounter].Value);
foo = (void(__cdecl*)(char*, unsigned long))(sectionMapping[coff_sym_ptr[tempcounter].SectionNumber - 1] + coff_sym_ptr[tempcounter].Value);
#else
foo = (void(*)(char *, unsigned long))(sectionMapping[coff_sym_ptr[tempcounter].SectionNumber - 1] + coff_sym_ptr[tempcounter].Value);
#endif
Expand Down
12 changes: 4 additions & 8 deletions beacon_compatibility.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,19 +291,15 @@ void BeaconGetSpawnTo(BOOL x86, char* buffer, int length) {
}
if (x86) {
tempBufferPath = "C:\\Windows\\"X86PATH"\\"DEFAULTPROCESSNAME;
if (strlen(tempBufferPath) > length) {
return;
}
memcpy(buffer, tempBufferPath, strlen(tempBufferPath));
}
else {
tempBufferPath = "C:\\Windows\\"X64PATH"\\"DEFAULTPROCESSNAME;
if (strlen(tempBufferPath) > length) {
return;
}
memcpy(buffer, tempBufferPath, strlen(tempBufferPath));
}

if ((int)strlen(tempBufferPath) > length) {
return;
}
memcpy(buffer, tempBufferPath, strlen(tempBufferPath));
return;
}

Expand Down

0 comments on commit 24da168

Please sign in to comment.