Fix crash in rabin2 -g (thanks @condret)

This commit is contained in:
pancake 2014-09-26 17:30:20 +02:00
parent 8449eafe3d
commit b53eb9222d
1 changed files with 10 additions and 5 deletions

View File

@ -152,6 +152,10 @@ static int extract_binobj (const RBinFile *bf, const RBinObject *o, int idx ) {
snprintf (outfile, outfile_sz, "%s/%s.%s_%i.%d",
outpath, ptr, arch, bits, idx);
if (boffset > r_buf_size (bf->buf)) {
eprintf ("Invalid offsets\n");
res = R_FALSE;
} else {
if (!outfile || !r_file_dump (outfile, bytes+boffset, bin_size)) {
eprintf ("Error extracting %s\n", outfile);
res = R_FALSE;
@ -159,6 +163,7 @@ static int extract_binobj (const RBinFile *bf, const RBinObject *o, int idx ) {
printf ("%s created (%"PFMT64d")\n", outfile, bin_size);
res = R_TRUE;
}
}
free (outfile);
free (outpath);