[ros-diffs] [fireball] 36661: 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.

fireball at svn.reactos.org fireball at svn.reactos.org
Mon Oct 6 12:19:56 CEST 2008


Author: fireball
Date: Mon Oct  6 05:19:55 2008
New Revision: 36661

URL: http://svn.reactos.org/svn/reactos?rev=36661&view=rev
Log:
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.

Modified:
    trunk/reactos/lib/fslib/vfatlib/check/lfn.c

Modified: trunk/reactos/lib/fslib/vfatlib/check/lfn.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/check/lfn.c?rev=36661&r1=36660&r2=36661&view=diff
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/check/lfn.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/check/lfn.c [iso-8859-1] Mon Oct  6 05:19:55 2008
@@ -410,8 +410,12 @@
 	}
     }
 
-    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 */



More information about the Ros-diffs mailing list