From feb1e5232e46ee5b0ee77eef09193a428ed11fd2 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Mon, 6 Oct 2008 10:19:55 +0000 Subject: [PATCH] Dmitry Gorbachev - lfn_get() reads past the end of name[]. Though harmless, it produces 'array subscript is above array bounds' compiler warning (treated as error). See issue #3762 for more details. svn path=/trunk/; revision=36661 --- reactos/lib/fslib/vfatlib/check/lfn.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reactos/lib/fslib/vfatlib/check/lfn.c b/reactos/lib/fslib/vfatlib/check/lfn.c index d57901bd7fd..af6b459dba5 100644 --- a/reactos/lib/fslib/vfatlib/check/lfn.c +++ b/reactos/lib/fslib/vfatlib/check/lfn.c @@ -410,8 +410,12 @@ char *lfn_get( DIR_ENT *de ) } } - for (sum = 0, i = 0; i < 11; i++) + for (sum = 0, i = 0; i < 8; i++) sum = (((sum&1) << 7) | ((sum&0xfe) >> 1)) + de->name[i]; + + for (i = 0; i < 3; i++) + sum = (((sum&1) << 7) | ((sum&0xfe) >> 1)) + de->ext[i]; + if (sum != lfn_checksum) { /* checksum doesn't match, long name doesn't apply to this alias */ /* Causes: 1) alias renamed */