From: Sven Hoexter Date: Sun, 19 Apr 2015 11:40:33 +0000 (+0200) Subject: Imported Upstream version 1.1.1 X-Git-Tag: upstream/1.1.1 X-Git-Url: https://git.sven.stormbind.net/?a=commitdiff_plain;h=2ae34810c300f30ddeb3d6eff2c1ffe5e906b055;p=sven%2Fexfat-utils.git Imported Upstream version 1.1.1 --- diff --git a/ChangeLog b/ChangeLog index ccfdde8..a741eae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +1.1.1 (2014-11-15) + +* Fixed mkfs crash on some sectors-per-cluster (-s option) values. + 1.1.0 (2014-07-08) * Relicensed the project from GPLv3+ to GPLv2+. diff --git a/libexfat/version.h b/libexfat/version.h index 20c1147..adabaad 100644 --- a/libexfat/version.h +++ b/libexfat/version.h @@ -25,6 +25,6 @@ #define EXFAT_VERSION_MAJOR 1 #define EXFAT_VERSION_MINOR 1 -#define EXFAT_VERSION_PATCH 0 +#define EXFAT_VERSION_PATCH 1 #endif /* ifndef VERSION_H_INCLUDED */ diff --git a/mkfs/cbm.c b/mkfs/cbm.c index e3e9dd2..e30928c 100644 --- a/mkfs/cbm.c +++ b/mkfs/cbm.c @@ -45,7 +45,7 @@ static int cbm_write(struct exfat_dev* dev) DIV_ROUND_UP(cbm.get_size(), get_cluster_size()) + DIV_ROUND_UP(uct.get_size(), get_cluster_size()) + DIV_ROUND_UP(rootdir.get_size(), get_cluster_size()); - size_t bitmap_size = DIV_ROUND_UP(allocated_clusters, CHAR_BIT); + size_t bitmap_size = ROUND_UP(allocated_clusters, CHAR_BIT); bitmap_t* bitmap = malloc(BMAP_SIZE(bitmap_size)); size_t i; @@ -57,13 +57,14 @@ static int cbm_write(struct exfat_dev* dev) } memset(bitmap, 0, BMAP_SIZE(bitmap_size)); - for (i = 0; i < bitmap_size * CHAR_BIT; i++) + for (i = 0; i < bitmap_size; i++) if (i < allocated_clusters) BMAP_SET(bitmap, i); - if (exfat_write(dev, bitmap, bitmap_size) < 0) + if (exfat_write(dev, bitmap, bitmap_size / CHAR_BIT) < 0) { free(bitmap); - exfat_error("failed to write bitmap of %zu bytes", bitmap_size); + exfat_error("failed to write bitmap of %zu bytes", + bitmap_size / CHAR_BIT); return 1; } free(bitmap);