Skip to content

Commit c43ceb8

Browse files
authored
Change the definition of shemu_printf so that unused parameters are removed from the compiled binary (#111)
* Change the definition of shemu_printf so that unused parameters (strings etc.) are removed from the compiled binary * Syntax fix * Fix the implementation of shemu_internal_printf * Replace NULL by ND_NULL in the invocation of shemu_internal_printf
1 parent c282f06 commit c43ceb8

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

bdshemu/bdshemu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313

1414
//
15-
// shemu_printf - simple version
15+
// shemu_internal_printf - simple version
1616
//
1717
#ifndef BDDISASM_NO_FORMAT
1818
void
19-
shemu_printf(
19+
shemu_internal_printf(
2020
SHEMU_CONTEXT *Context,
2121
char *formatstring,
2222
...
@@ -41,7 +41,7 @@ shemu_printf(
4141
}
4242
#else
4343
void
44-
shemu_printf(
44+
shemu_internal_printf(
4545
SHEMU_CONTEXT *Context,
4646
char *formatstring,
4747
...

bdshemu/include/bdshemu_common.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
#endif
1313

1414

15+
#ifndef BDDISASM_NO_FORMAT
16+
#define shemu_printf(Context, formatstring, ...) shemu_internal_printf(Context, formatstring, __VA_ARGS__)
17+
#else
18+
#define shemu_printf(Context, formatstring, ...) do { (void)formatstring; shemu_internal_printf(Context, ND_NULL, __VA_ARGS__); } while (0)
19+
#endif
20+
1521
// The SHELLBMP and STACKBMP are two bitmaps which hold the state of each shellcode byte and each stack byte.
1622
// Inside SHELLBMP, we store whether a shellcode byte has been fetched for execution or not, and whether it was
1723
// modified or not.
@@ -65,7 +71,7 @@
6571

6672

6773
void
68-
shemu_printf(
74+
shemu_internal_printf(
6975
SHEMU_CONTEXT *Context,
7076
char *formatstring,
7177
...

0 commit comments

Comments
 (0)