* libr/bin/bin.c: Temporary solution to fix malloc:// * libr/bin/t/test_create.c: Add missing return * libr/bin/t/test_create.c: Fix gcc warning * libr/core/cmd.c: Fix read from uninitialized memory * libr/io/io.c: Fix uninitialized variable * libr/print/print.c: Prevent invalid read * libr/util/buf.c: Don't return free()d memory in r_buf_mmap()
23 lines
664 B
C
23 lines
664 B
C
#include <r_bin.h>
|
|
|
|
int main () {
|
|
#define _BUFFER_SIZE 64
|
|
unsigned char code[64] = {
|
|
0x31, 0xc0, 0x40, 0x68, 0x2a, 0x00, 0x00, 0x00, 0x81, 0xec, 0x04,
|
|
0x00, 0x00, 0x00, 0xcd, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
|
RBuffer *b;
|
|
RBin *bin = r_bin_new ();
|
|
if (!r_bin_use_arch (bin, "x86", 32, "mach0")) {
|
|
eprintf ("Cannot set arch\n");
|
|
return 1;
|
|
}
|
|
b = r_bin_create (bin, code, _BUFFER_SIZE, NULL, 0);
|
|
if (b) {
|
|
if (r_file_dump ("a.out", b->buf, b->length))
|
|
eprintf ("dumped %d bytes in a.out\n", b->length);
|
|
else eprintf ("error dumping into a.out\n");
|
|
} else eprintf ("So fucking oops\n");
|
|
r_bin_free (bin);
|
|
r_buf_free (b);
|
|
return 0;
|
|
}
|