* [U-Boot] [PATCH 1/7] FAT: get_fatent: Fix FAT boundary check
@ 2012-07-19 22:01 Benoît Thébaudeau
2012-07-20 13:19 ` [U-Boot] [PATCH v2 2/8] " Benoît Thébaudeau
0 siblings, 1 reply; 3+ messages in thread
From: Benoît Thébaudeau @ 2012-07-19 22:01 UTC (permalink / raw)
To: u-boot
startblock must be taken into account in order not to read past the end of the
FAT.
Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
---
.../fs/fat/fat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git u-boot-66714b1.orig/fs/fat/fat.c u-boot-66714b1/fs/fat/fat.c
index bc46cc5..f6fd457 100644
--- u-boot-66714b1.orig/fs/fat/fat.c
+++ u-boot-66714b1/fs/fat/fat.c
@@ -207,8 +207,8 @@ static __u32 get_fatent (fsdata *mydata, __u32 entry)
__u32 fatlength = mydata->fatlength;
__u32 startblock = bufnum * FATBUFBLOCKS;
- if (getsize > fatlength)
- getsize = fatlength;
+ if (startblock + getsize > fatlength)
+ getsize = fatlength - startblock;
fatlength *= mydata->sect_size; /* We want it in bytes now */
startblock += mydata->fat_sect; /* Offset from start of disk */
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2 2/8] FAT: get_fatent: Fix FAT boundary check
2012-07-19 22:01 [U-Boot] [PATCH 1/7] FAT: get_fatent: Fix FAT boundary check Benoît Thébaudeau
@ 2012-07-20 13:19 ` Benoît Thébaudeau
2012-09-02 15:14 ` Wolfgang Denk
0 siblings, 1 reply; 3+ messages in thread
From: Benoît Thébaudeau @ 2012-07-20 13:19 UTC (permalink / raw)
To: u-boot
startblock must be taken into account in order not to read past the end of the
FAT.
Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
---
Changes for v2:
- Patch renumbering because of the new v2 1/8.
- Possible code style changes due to the new v2 1/8.
.../fs/fat/fat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git u-boot-66714b1.orig/fs/fat/fat.c u-boot-66714b1/fs/fat/fat.c
index 9f83572..87a1623 100644
--- u-boot-66714b1.orig/fs/fat/fat.c
+++ u-boot-66714b1/fs/fat/fat.c
@@ -207,8 +207,8 @@ static __u32 get_fatent(fsdata *mydata, __u32 entry)
__u32 fatlength = mydata->fatlength;
__u32 startblock = bufnum * FATBUFBLOCKS;
- if (getsize > fatlength)
- getsize = fatlength;
+ if (startblock + getsize > fatlength)
+ getsize = fatlength - startblock;
fatlength *= mydata->sect_size; /* We want it in bytes now */
startblock += mydata->fat_sect; /* Offset from start of disk */
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2 2/8] FAT: get_fatent: Fix FAT boundary check
2012-07-20 13:19 ` [U-Boot] [PATCH v2 2/8] " Benoît Thébaudeau
@ 2012-09-02 15:14 ` Wolfgang Denk
0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2012-09-02 15:14 UTC (permalink / raw)
To: u-boot
Dear Beno?t Th?baudeau,
In message <907420307.332540.1342790369965.JavaMail.root@advansee.com> you wrote:
> startblock must be taken into account in order not to read past the end of =
> the
> FAT.
>
> Signed-off-by: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
> Cc: Wolfgang Denk <wd@denx.de>
> ---
> Changes for v2:
> - Patch renumbering because of the new v2 1/8.
> - Possible code style changes due to the new v2 1/8.
>
> .../fs/fat/fat.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Any sufficiently advanced technology is indistinguishable from magic.
Clarke's Third Law - _Profiles of the Future_ (1962; rev. 1973)
``Hazards of Prophecy: The Failure of Imagination''
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-02 15:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-19 22:01 [U-Boot] [PATCH 1/7] FAT: get_fatent: Fix FAT boundary check Benoît Thébaudeau
2012-07-20 13:19 ` [U-Boot] [PATCH v2 2/8] " Benoît Thébaudeau
2012-09-02 15:14 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox