From 11dff3540156eb12075f97dfd31f8e26c91dd957 Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Wed, 5 Jun 2024 10:53:45 +0200 Subject: [PATCH 1/3] lib: Reset errno before running strtoul in exfat_parse_ulong Without this the exfat_parse_ulong can fail when errno was set by a different previously called function. This for example happens when calling tune.exfat with C.UTF-8 locale: setlocale sets errno without failing and because of this setting a valid serial number fails: $ sudo LC_ALL=C.UTF-8 tune.exfat -I 0xE67BF34D /dev/loop0 invalid serial number(0xE67BF34D) Signed-off-by: Vojtech Trefny Signed-off-by: Namjae Jeon --- lib/libexfat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libexfat.c b/lib/libexfat.c index 0bcb4a4..9cc184f 100644 --- a/lib/libexfat.c +++ b/lib/libexfat.c @@ -1046,6 +1046,8 @@ int exfat_parse_ulong(const char *s, unsigned long *out) { char *endptr; + errno = 0; + *out = strtoul(s, &endptr, 0); if (errno) From a05ebff2a071688be4b29734d24dbd9433f9791f Mon Sep 17 00:00:00 2001 From: Pavel Reichl Date: Tue, 11 Jun 2024 22:52:14 +0200 Subject: [PATCH 2/3] lib: Fix memory leak Signed-off-by: Pavel Reichl Signed-off-by: Namjae Jeon --- lib/exfat_fs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/exfat_fs.c b/lib/exfat_fs.c index be76e59..b24f532 100644 --- a/lib/exfat_fs.c +++ b/lib/exfat_fs.c @@ -128,8 +128,10 @@ struct exfat *exfat_alloc_exfat(struct exfat_blk_dev *blk_dev, struct pbr *bs) struct exfat *exfat; exfat = calloc(1, sizeof(*exfat)); - if (!exfat) + if (!exfat) { + free(bs); return NULL; + } INIT_LIST_HEAD(&exfat->dir_list); exfat->blk_dev = blk_dev; From 9091dfffacb6f7e61eff66afc8cca3c9c124b989 Mon Sep 17 00:00:00 2001 From: Hyunchul Lee Date: Mon, 17 Jun 2024 09:50:22 +0900 Subject: [PATCH 3/3] exfatprogs: release 1.2.4 version BUG FIXES : * tune.exfat: Fix "invalid serial number" error when setting an serial number. * fsck.exfat: Fix memory leak in an error path Signed-off-by: Hyunchul Lee Signed-off-by: Namjae Jeon --- NEWS | 8 ++++++++ include/version.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index a72c9c6..072344e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +exfatprogs 1.2.4 - released 2024-06-17 +====================================== + +BUG FIXES : + * tune.exfat: Fix "invalid serial number" error when + setting an serial number. + * fsck.exfat: Fix memory leak in an error path + exfatprogs 1.2.3 - released 2024-05-23 ====================================== diff --git a/include/version.h b/include/version.h index bef66aaf..31f150e 100644 --- a/include/version.h +++ b/include/version.h @@ -5,6 +5,6 @@ #ifndef _VERSION_H -#define EXFAT_PROGS_VERSION "1.2.3" +#define EXFAT_PROGS_VERSION "1.2.4" #endif /* !_VERSION_H */