diff -Nru exfatprogs-1.1.2/configure exfatprogs-1.1.3/configure --- exfatprogs-1.1.2/configure 2021-05-20 04:45:59.584860605 +0000 +++ exfatprogs-1.1.3/configure 2021-11-17 09:14:16.734016170 +0000 @@ -1,6 +1,6 @@ #! /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 . # @@ -590,8 +590,8 @@ # 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' @@ -1325,7 +1325,7 @@ # 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]... @@ -1396,7 +1396,7 @@ 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 @@ -1508,7 +1508,7 @@ 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. @@ -1786,7 +1786,7 @@ 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 $@ @@ -2654,7 +2654,7 @@ # Define the identity of the package. PACKAGE='exfatprogs' - VERSION='1.1.2' + VERSION='1.1.3' cat >>confdefs.h <<_ACEOF @@ -13256,7 +13256,7 @@ # 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 @@ -13323,7 +13323,7 @@ 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\\" diff -Nru exfatprogs-1.1.2/COPYING exfatprogs-1.1.3/COPYING --- exfatprogs-1.1.2/COPYING 2021-05-20 04:45:37.705119168 +0000 +++ exfatprogs-1.1.3/COPYING 2021-11-17 09:13:55.729267514 +0000 @@ -56,7 +56,7 @@ 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 @@ -277,9 +277,9 @@ 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 diff -Nru exfatprogs-1.1.2/debian/changelog exfatprogs-1.1.3/debian/changelog --- exfatprogs-1.1.2/debian/changelog 2021-08-16 17:55:59.000000000 +0000 +++ exfatprogs-1.1.3/debian/changelog 2021-11-17 19:10:43.000000000 +0000 @@ -1,3 +1,10 @@ +exfatprogs (1.1.3-1) unstable; urgency=medium + + * New upstream release. + * Update Standards-Version to 4.6.0 - no changes required. + + -- Sven Hoexter Wed, 17 Nov 2021 20:10:43 +0100 + exfatprogs (1.1.2-2) unstable; urgency=medium * Post stable release upload to unstable. diff -Nru exfatprogs-1.1.2/debian/control exfatprogs-1.1.3/debian/control --- exfatprogs-1.1.2/debian/control 2021-02-10 08:23:02.000000000 +0000 +++ exfatprogs-1.1.3/debian/control 2021-11-17 19:10:43.000000000 +0000 @@ -3,7 +3,7 @@ Priority: optional Maintainer: Sven Hoexter Build-Depends: debhelper-compat (= 13), pkg-config -Standards-Version: 4.5.1 +Standards-Version: 4.6.0 Rules-Requires-Root: no Homepage: https://github.com/exfatprogs/exfatprogs Vcs-Git: https://git.sven.stormbind.net/exfatprogs.git diff -Nru exfatprogs-1.1.2/fsck/fsck.c exfatprogs-1.1.3/fsck/fsck.c --- exfatprogs-1.1.2/fsck/fsck.c 2021-05-20 04:45:37.705119168 +0000 +++ exfatprogs-1.1.3/fsck/fsck.c 2021-11-17 09:13:55.729267514 +0000 @@ -261,7 +261,7 @@ /* * 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. */ @@ -1477,6 +1477,11 @@ 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) { @@ -1596,8 +1601,10 @@ goto err; ret = init_exfat(exfat, bs); - if (ret) + if (ret) { + exfat = NULL; goto err; + } if (exfat_mark_volume_dirty(exfat, true)) { ret = -EIO; diff -Nru exfatprogs-1.1.2/include/libexfat.h exfatprogs-1.1.3/include/libexfat.h --- exfatprogs-1.1.2/include/libexfat.h 2021-05-20 04:45:37.705119168 +0000 +++ exfatprogs-1.1.3/include/libexfat.h 2021-11-17 09:13:55.729267514 +0000 @@ -34,7 +34,7 @@ #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 */ diff -Nru exfatprogs-1.1.2/include/list.h exfatprogs-1.1.3/include/list.h --- exfatprogs-1.1.2/include/list.h 2021-05-20 04:45:37.705119168 +0000 +++ exfatprogs-1.1.3/include/list.h 2021-11-17 09:13:55.729267514 +0000 @@ -84,7 +84,6 @@ __list_add(new, head->prev, head); } - /* * Delete a list entry by making the prev/next entries * point to each other. @@ -111,8 +110,6 @@ entry->prev = LIST_POISON2; } - - /** * list_del_init - deletes entry from list and reinitialize it. * @entry: the element to delete from the list. diff -Nru exfatprogs-1.1.2/include/version.h exfatprogs-1.1.3/include/version.h --- exfatprogs-1.1.2/include/version.h 2021-05-20 04:45:37.705119168 +0000 +++ exfatprogs-1.1.3/include/version.h 2021-11-17 09:13:55.729267514 +0000 @@ -5,6 +5,6 @@ #ifndef _VERSION_H -#define EXFAT_PROGS_VERSION "1.1.2" +#define EXFAT_PROGS_VERSION "1.1.3" #endif /* !_VERSION_H */ diff -Nru exfatprogs-1.1.2/lib/libexfat.c exfatprogs-1.1.3/lib/libexfat.c --- exfatprogs-1.1.2/lib/libexfat.c 2021-05-20 04:45:37.705119168 +0000 +++ exfatprogs-1.1.3/lib/libexfat.c 2021-11-17 09:13:55.729267514 +0000 @@ -475,8 +475,7 @@ 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; @@ -490,8 +489,7 @@ 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); diff -Nru exfatprogs-1.1.2/Makefile.in exfatprogs-1.1.3/Makefile.in --- exfatprogs-1.1.2/Makefile.in 2021-05-20 04:46:00.144854030 +0000 +++ exfatprogs-1.1.3/Makefile.in 2021-11-17 09:14:34.118613976 +0000 @@ -198,7 +198,7 @@ $(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) diff -Nru exfatprogs-1.1.2/mkfs/mkfs.c exfatprogs-1.1.3/mkfs/mkfs.c --- exfatprogs-1.1.2/mkfs/mkfs.c 2021-05-20 04:45:37.705119168 +0000 +++ exfatprogs-1.1.3/mkfs/mkfs.c 2021-11-17 09:13:55.733267659 +0000 @@ -46,14 +46,14 @@ 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); @@ -235,9 +235,9 @@ 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); @@ -321,8 +321,7 @@ 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); @@ -359,8 +358,7 @@ 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); @@ -440,6 +438,11 @@ 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); @@ -447,8 +450,12 @@ } 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) { diff -Nru exfatprogs-1.1.2/mkfs/upcase.c exfatprogs-1.1.3/mkfs/upcase.c --- exfatprogs-1.1.2/mkfs/upcase.c 2021-05-20 04:45:37.705119168 +0000 +++ exfatprogs-1.1.3/mkfs/upcase.c 2021-11-17 09:13:55.733267659 +0000 @@ -506,8 +506,7 @@ { 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; diff -Nru exfatprogs-1.1.2/NEWS exfatprogs-1.1.3/NEWS --- exfatprogs-1.1.2/NEWS 2021-05-20 04:45:37.705119168 +0000 +++ exfatprogs-1.1.3/NEWS 2021-11-17 09:13:55.729267514 +0000 @@ -1,3 +1,16 @@ +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 ====================================== diff -Nru exfatprogs-1.1.2/README.md exfatprogs-1.1.3/README.md --- exfatprogs-1.1.2/README.md 2021-05-20 04:45:37.705119168 +0000 +++ exfatprogs-1.1.3/README.md 2021-11-17 09:13:55.729267514 +0000 @@ -116,4 +116,4 @@ ## 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`).