Changeset 9e7615d in mainline


Ignore:
Timestamp:
2017-06-27T16:32:35Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b76ce3f
Parents:
80da8f70
Message:

Avoid misinterpreting FAT boot record as MBR.

Location:
uspace/lib/label
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/label/src/mbr.c

    r80da8f70 r9e7615d  
    3939#include <stdlib.h>
    4040
     41#include "std/fat.h"
    4142#include "std/mbr.h"
    4243#include "mbr.h"
     
    8990        label_t *label = NULL;
    9091        mbr_br_block_t *mbr = NULL;
     92        fat_bs_t *bs;
    9193        mbr_pte_t *eptr;
    9294        uint16_t sgn;
     
    124126        }
    125127
     128        bs = (fat_bs_t *)mbr;
     129
    126130        rc = bd->ops->read(bd->arg, mbr_ba, 1, mbr);
    127131        if (rc != EOK) {
     
    145149        }
    146150
     151        /*
     152         * We can't really tell whether this is an MBR. Make sure
     153         * this is not actually the BR of a FAT file system
     154         */
     155        if (bs->type[0] == 'F' && bs->type[1] == 'A' && bs->type[2] == 'T') {
     156                rc = EIO;
     157                goto error;
     158        }
    147159
    148160        label->ext_part = NULL;
Note: See TracChangeset for help on using the changeset viewer.