mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-09 03:43:28 +00:00
Autodetect and mount ISO9660 partitions
This commit is contained in:
parent
2e08b0c91f
commit
5fc5137c70
@ -1102,7 +1102,8 @@ int main(int argc, char **argv, char **envp) {
|
||||
return 1;
|
||||
}
|
||||
if (r.bin->cur && r.bin->cur->o && r.bin->cur->o->info && r.bin->cur->o->info->rclass && !strcmp ("fs", r.bin->cur->o->info->rclass)) {
|
||||
r_core_cmd0 (&r, "m /root @ 0");
|
||||
const char *fstype = r.bin->cur->o->info->bclass;
|
||||
r_core_cmdf (&r, "m /root %s @ 0", fstype);
|
||||
}
|
||||
iod = r.io ? r_io_desc_get (r.io, fh->fd) : NULL;
|
||||
#if USE_THREADS
|
||||
|
@ -15,20 +15,21 @@ static char *fsname(const ut8* buf, ut64 length) {
|
||||
|
||||
len = R_MIN (f->buflen, sizeof (fs_lbuf));
|
||||
memset (fs_lbuf, 0, sizeof (fs_lbuf));
|
||||
|
||||
if (f->bufoff + len > length) break;
|
||||
if (f->bufoff + len > length) {
|
||||
break;
|
||||
}
|
||||
memcpy (fs_lbuf, buf + f->bufoff, len);
|
||||
|
||||
if ((f->buflen > 0) && (len >= f->buflen)) {
|
||||
if ((f->buflen > 0) && len >= f->buflen) {
|
||||
int min = R_MIN (f->buflen, sizeof (fs_lbuf));
|
||||
if (!memcmp (fs_lbuf, f->buf, min)) {
|
||||
ret = true;
|
||||
len = R_MIN (f->bytelen, sizeof (fs_lbuf));
|
||||
|
||||
if (f->byteoff + len > length) break;
|
||||
if (f->byteoff + len > length) {
|
||||
break;
|
||||
}
|
||||
memcpy (fs_lbuf, buf + f->byteoff, len);
|
||||
|
||||
for (j = 0; j < f->bytelen; j++) {
|
||||
// for (j = 0; j < f->bytelen; j++) {
|
||||
for (j = 0; j < len; j++) {
|
||||
if (fs_lbuf[j] != f->byte) {
|
||||
ret = false;
|
||||
break;
|
||||
|
@ -77,7 +77,8 @@ static int cmd_mount(void *data, const char *_input) {
|
||||
} else {
|
||||
if (!(ptr = r_fs_name (core->fs, core->offset))) {
|
||||
eprintf ("Unknown filesystem type\n");
|
||||
} else if (!r_fs_mount (core->fs, ptr, input, core->offset)) {
|
||||
}
|
||||
if (!r_fs_mount (core->fs, ptr, input, core->offset)) {
|
||||
eprintf ("Cannot mount %s\n", input);
|
||||
}
|
||||
free (ptr);
|
||||
|
@ -109,8 +109,8 @@ R_API RFSRoot* r_fs_mount(RFS* fs, const char* fstype, const char* path, ut64 de
|
||||
eprintf ("r_fs_mount: invalid mountpoint %s\n", path);
|
||||
return NULL;
|
||||
}
|
||||
if (!fstype) {
|
||||
fstype = r_fs_name(fs, delta);
|
||||
if (!fstype || !*fstype) {
|
||||
fstype = r_fs_name (fs, delta);
|
||||
}
|
||||
if (!(p = r_fs_plugin_get (fs, fstype))) {
|
||||
// eprintf ("r_fs_mount: Invalid filesystem type\n");
|
||||
@ -645,7 +645,8 @@ R_API char* r_fs_name(RFS* fs, ut64 offset) {
|
||||
ret = true;
|
||||
len = R_MIN (f->bytelen, sizeof (buf));
|
||||
fs->iob.read_at (fs->iob.io, offset + f->byteoff, buf, len);
|
||||
for (j = 0; j < f->bytelen; j++) {
|
||||
// for (j = 0; j < f->bytelen; j++) {
|
||||
for (j = 0; j < len; j++) {
|
||||
if (buf[j] != f->byte) {
|
||||
ret = false;
|
||||
break;
|
||||
|
@ -15,5 +15,6 @@ static RFSType fstypes[] = {
|
||||
{ "fat", 0x52, "FAT32", 5, 0, 0, 0 },
|
||||
{ "ext2", 0x438, "\x53\xef", 2, 0, 0, 0 },
|
||||
{ "btrfs", 0x10040, "_BHRfS_M", 8, 0, 0, 0x0 },
|
||||
{ "iso9660", 0x8000, "\x01" "CD0", 4, 0, 0, 0x8000 },
|
||||
{ NULL }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user