The precise terms and conditions for copying, distribution and
modification follow.
- GNU GENERAL PUBLIC LICENSE
+ GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
- END OF TERMS AND CONDITIONS
+ END OF TERMS AND CONDITIONS
- How to Apply These Terms to Your New Programs
+ How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
$(top_srcdir)/build-aux/install-sh \
$(top_srcdir)/build-aux/ltmain.sh \
$(top_srcdir)/build-aux/missing COPYING NEWS build-aux/compile \
- build-aux/config.guess build-aux/config.sub \
+ build-aux/config.guess build-aux/config.sub build-aux/depcomp \
build-aux/install-sh build-aux/ltmain.sh build-aux/missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
+exfatprogs 1.1.3 - released 2021-11-11
+======================================
+
+CHANGES :
+ * mkfs.exfat: ensure that the cluster size is greater than or
+ equal than the sector size.
+ * mkfs.exfat: replace lseek() + write() with pwrite().
+
+BUG FIXES :
+ * mkfs.exfat: prevent an integer overflow when computing the FAT
+ length.
+ * fsck.exfat: fix a double free memory error.
+
exfatprogs 1.1.2 - released 2021-05-20
======================================
## Contributor information
* Please base your pull requests on the `exfat-next` branch.
-* Make sure you add 'Signed-Off' information to your commits (e. g. `git commit --signoff`).
+* Make sure you add 'Signed-Off' information to your commits (e.g. `git commit --signoff`).
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for exfatprogs 1.1.2.
+# Generated by GNU Autoconf 2.69 for exfatprogs 1.1.3.
#
# Report bugs to <linkinjeon@kernel.org>.
#
# Identity of this package.
PACKAGE_NAME='exfatprogs'
PACKAGE_TARNAME='exfatprogs'
-PACKAGE_VERSION='1.1.2'
-PACKAGE_STRING='exfatprogs 1.1.2'
+PACKAGE_VERSION='1.1.3'
+PACKAGE_STRING='exfatprogs 1.1.3'
PACKAGE_BUGREPORT='linkinjeon@kernel.org'
PACKAGE_URL='https://github.com/exfatprogs/exfatprogs'
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures exfatprogs 1.1.2 to adapt to many kinds of systems.
+\`configure' configures exfatprogs 1.1.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of exfatprogs 1.1.2:";;
+ short | recursive ) echo "Configuration of exfatprogs 1.1.3:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-exfatprogs configure 1.1.2
+exfatprogs configure 1.1.3
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by exfatprogs $as_me 1.1.2, which was
+It was created by exfatprogs $as_me 1.1.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
# Define the identity of the package.
PACKAGE='exfatprogs'
- VERSION='1.1.2'
+ VERSION='1.1.3'
cat >>confdefs.h <<_ACEOF
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by exfatprogs $as_me 1.1.2, which was
+This file was extended by exfatprogs $as_me 1.1.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-exfatprogs config.status 1.1.2
+exfatprogs config.status 1.1.3
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
/*
* get references of ancestors that include @child until the count of
- * ancesters is not larger than @count and the count of characters of
+ * ancestors is not larger than @count and the count of characters of
* their names is not larger than @max_char_len.
* return true if root is reached.
*/
shift += 10;
}
+ if (i >= sizeof(units)/sizeof(units[0])) {
+ i = i - 1;
+ shift = shift - 10;
+ }
+
quoti = (unsigned int)(bytes / (1ULL << shift));
remain = 0;
if (shift > 0) {
goto err;
ret = init_exfat(exfat, bs);
- if (ret)
+ if (ret) {
+ exfat = NULL;
goto err;
+ }
if (exfat_mark_volume_dirty(exfat, true)) {
ret = -EIO;
#define VOLUME_LABEL_BUFFER_SIZE (VOLUME_LABEL_MAX_LEN*MB_LEN_MAX+1)
-/* Upcase tabel macro */
+/* Upcase table macro */
#define EXFAT_UPCASE_TABLE_SIZE (5836)
/* Flags for tune.exfat and exfatlabel */
__list_add(new, head->prev, head);
}
-
/*
* Delete a list entry by making the prev/next entries
* point to each other.
entry->prev = LIST_POISON2;
}
-
-
/**
* list_del_init - deletes entry from list and reinitialize it.
* @entry: the element to delete from the list.
#ifndef _VERSION_H
-#define EXFAT_PROGS_VERSION "1.1.2"
+#define EXFAT_PROGS_VERSION "1.1.3"
#endif /* !_VERSION_H */
int ret;
unsigned long long offset = sec_off * bd->sector_size;
- lseek(bd->dev_fd, offset, SEEK_SET);
- ret = read(bd->dev_fd, buf, bd->sector_size);
+ ret = pread(bd->dev_fd, buf, bd->sector_size, offset);
if (ret < 0) {
exfat_err("read failed, sec_off : %u\n", sec_off);
return -1;
int bytes;
unsigned long long offset = sec_off * bd->sector_size;
- lseek(bd->dev_fd, offset, SEEK_SET);
- bytes = write(bd->dev_fd, buf, bd->sector_size);
+ bytes = pwrite(bd->dev_fd, buf, bd->sector_size, offset);
if (bytes != (int)bd->sector_size) {
exfat_err("write failed, sec_off : %u, bytes : %d\n", sec_off,
bytes);
struct bsx64 *pbsx = &ppbr->bsx;
unsigned int i;
- /* Fill exfat BIOS paramemter block */
+ /* Fill exfat BIOS parameter block */
pbpb->jmp_boot[0] = 0xeb;
pbpb->jmp_boot[1] = 0x76;
pbpb->jmp_boot[2] = 0x90;
memcpy(pbpb->oem_name, "EXFAT ", 8);
memset(pbpb->res_zero, 0, 53);
- /* Fill exfat extend BIOS paramemter block */
+ /* Fill exfat extend BIOS parameter block */
pbsx->vol_offset = cpu_to_le64(bd->offset / bd->sector_size);
pbsx->vol_length = cpu_to_le64(bd->size / bd->sector_size);
pbsx->fat_offset = cpu_to_le32(finfo.fat_byte_off / bd->sector_size);
unsigned long long offset)
{
int nbyte;
+ off_t fat_entry_offset = finfo.fat_byte_off + (offset * sizeof(__le32));
- lseek(fd, finfo.fat_byte_off + (offset * sizeof(__le32)), SEEK_SET);
- nbyte = write(fd, (__u8 *) &clu, sizeof(__le32));
+ nbyte = pwrite(fd, (__u8 *) &clu, sizeof(__le32), fat_entry_offset);
if (nbyte != sizeof(int)) {
exfat_err("write failed, offset : %llu, clu : %x\n",
offset, clu);
for (i = 0; i < finfo.used_clu_cnt - EXFAT_FIRST_CLUSTER; i++)
exfat_set_bit(bd, bitmap, i);
- lseek(bd->dev_fd, finfo.bitmap_byte_off, SEEK_SET);
- nbytes = write(bd->dev_fd, bitmap, finfo.bitmap_byte_len);
+ nbytes = pwrite(bd->dev_fd, bitmap, finfo.bitmap_byte_len, finfo.bitmap_byte_off);
if (nbytes != finfo.bitmap_byte_len) {
exfat_err("write failed, nbytes : %d, bitmap_len : %d\n",
nbytes, finfo.bitmap_byte_len);
ed[2].upcase_start_clu = cpu_to_le32(finfo.ut_start_clu);
ed[2].upcase_size = cpu_to_le64(EXFAT_UPCASE_TABLE_SIZE);
- lseek(bd->dev_fd, finfo.root_byte_off, SEEK_SET);
- nbytes = write(bd->dev_fd, ed, dentries_len);
+ nbytes = pwrite(bd->dev_fd, ed, dentries_len, finfo.root_byte_off);
if (nbytes != dentries_len) {
exfat_err("write failed, nbytes : %d, dentries_len : %d\n",
nbytes, dentries_len);
unsigned long long total_clu_cnt;
int clu_len;
+ if (ui->cluster_size < bd->sector_size) {
+ exfat_err("cluster size (%u bytes) is smaller than sector size (%u bytes)\n",
+ ui->cluster_size, bd->sector_size);
+ return -1;
+ }
if (ui->boundary_align < bd->sector_size) {
exfat_err("boundary alignment is too small (min %d)\n",
bd->sector_size);
}
finfo.fat_byte_off = round_up(bd->offset + 24 * bd->sector_size,
ui->boundary_align) - bd->offset;
- finfo.fat_byte_len = round_up((bd->num_clusters * sizeof(int)),
- ui->cluster_size);
+ /* Prevent integer overflow when computing the FAT length */
+ if (bd->num_clusters > UINT32_MAX / 4) {
+ exfat_err("cluster size (%u bytes) is too small\n", ui->cluster_size);
+ return -1;
+ }
+ finfo.fat_byte_len = round_up((bd->num_clusters * 4), ui->cluster_size);
finfo.clu_byte_off = round_up(bd->offset + finfo.fat_byte_off +
finfo.fat_byte_len, ui->boundary_align) - bd->offset;
if (bd->size <= finfo.clu_byte_off) {
{
int nbytes;
- lseek(bd->dev_fd, finfo.ut_byte_off, SEEK_SET);
- nbytes = write(bd->dev_fd, upcase_table, EXFAT_UPCASE_TABLE_SIZE);
+ nbytes = pwrite(bd->dev_fd, upcase_table, EXFAT_UPCASE_TABLE_SIZE, finfo.ut_byte_off);
if (nbytes != EXFAT_UPCASE_TABLE_SIZE)
return -1;