Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warnings #5

Merged
merged 1 commit into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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