OSDN Git Service
(root)
/
android-x86
/
external-exfat.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c236f87
)
Check device size on mount.
author
relan
<relan@users.noreply.github.com>
Sun, 23 Feb 2014 11:23:55 +0000
(11:23 +0000)
committer
relan
<relan@users.noreply.github.com>
Mon, 24 Aug 2015 05:26:16 +0000
(08:26 +0300)
libexfat/mount.c
patch
|
blob
|
history
diff --git
a/libexfat/mount.c
b/libexfat/mount.c
index
c161372
..
70c8af5
100644
(file)
--- a/
libexfat/mount.c
+++ b/
libexfat/mount.c
@@
-24,6
+24,7
@@
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
+#include <inttypes.h>
#include <unistd.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
@@
-252,6
+253,18
@@
int exfat_mount(struct exfat* ef, const char* spec, const char* options)
free(ef->sb);
return -EIO;
}
free(ef->sb);
return -EIO;
}
+ if (le64_to_cpu(ef->sb->sector_count) * SECTOR_SIZE(*ef->sb) >
+ exfat_get_size(ef->dev))
+ {
+ free(ef->zero_cluster);
+ exfat_error("file system is larger than underlying device: "
+ "%"PRIu64" > %"PRIu64,
+ le64_to_cpu(ef->sb->sector_count) * SECTOR_SIZE(*ef->sb),
+ exfat_get_size(ef->dev));
+ exfat_close(ef->dev);
+ free(ef->sb);
+ return -EIO;
+ }
ef->root = malloc(sizeof(struct exfat_node));
if (ef->root == NULL)
ef->root = malloc(sizeof(struct exfat_node));
if (ef->root == NULL)