Imported Upstream version 1.1.1 upstream/1.1.1
authorSven Hoexter <sven@stormbind.net>
Sun, 19 Apr 2015 11:40:33 +0000 (13:40 +0200)
committerSven Hoexter <sven@stormbind.net>
Sun, 19 Apr 2015 11:40:33 +0000 (13:40 +0200)
ChangeLog
libexfat/version.h
mkfs/cbm.c

index ccfdde8a467b00a2d1653a4681cf4686d872c477..a741eae5473be66b184307f5bde1a5bc267d94d7 100644 (file)
--- 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+.
index 20c1147aee2a763d8eb862b2b0050f9a8f5f779c..adabaadc4943e372ea3f46f2be37e3628d4b9fc5 100644 (file)
@@ -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 */
index e3e9dd28511bc629a4a698162946c81e24a8fff4..e30928cc0d0ea54581e3a50394cabe6a7e74b701 100644 (file)
@@ -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);