- malloc and memset, don't worry about the implicit declaration "warning" messages at runtime
- returning a buffer as a variable
- returning an integer as a variable passed as argument
- print hexdump with size
Code: Select all
set MEMORY_FILE10 string "
unsigned char *func(
int size,
int *output_int
) {
unsigned char *data = malloc(size);
memset(data, 'a', size);
*output_int = 12345678;
return data;
}
"
math RET2 = 0 # it must be declared first
math SIZE = 123
calldll MEMORY_FILE10 func tcc &RET SIZE &RET2
print "%RET2%"
print "%RET|hexdump SIZE%"
Not sure why RET2 must be declared first.