Fix null deref and bad indent

This commit is contained in:
pancake 2014-07-17 05:49:20 +02:00
parent 5b673030ff
commit 381d86de2a
2 changed files with 4 additions and 3 deletions

View File

@ -491,9 +491,8 @@ int main(int argc, char **argv) {
datalen = 0;
}
code = malloc (strlen (p)+1);
if (!code) {
if (!code)
return 1;
}
codelen = r_hex_str2bin (p, code);
if (!arch) arch = "x86";
if (!bits) bits = 32;

View File

@ -591,8 +591,10 @@ static RBuffer* create(RBin* bin, const ut8 *code, int codelen, const ut8 *data,
ut16 ehdrsz, phdrsz;
ut32 p_vaddr, p_paddr, p_fs, p_fs2;
ut32 baddr;
int is_arm = !strcmp (bin->cur->o->info->arch, "arm");
int is_arm = 0;
RBuffer *buf = r_buf_new ();
if (bin && bin->cur && bin->cur->o && bin->cur->o->info)
is_arm = !strcmp (bin->cur->o->info->arch, "arm");
// XXX: hardcoded
if (is_arm) {
baddr = 0x40000;