Module Name:    src
Committed By:   maya
Date:           Sat Jan 14 17:17:53 UTC 2017

Modified Files:
        src/sys/fs/msdosfs: denode.h

Log Message:
Be explicit about how we're placing part of the on-disk name into
the extension, so it doesn't appear like we are overrunning an array.
Appeases coverity, NFC.

ok riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/fs/msdosfs/denode.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/msdosfs/denode.h
diff -u src/sys/fs/msdosfs/denode.h:1.24 src/sys/fs/msdosfs/denode.h:1.25
--- src/sys/fs/msdosfs/denode.h:1.24	Tue Jul  8 09:21:52 2014
+++ src/sys/fs/msdosfs/denode.h	Sat Jan 14 17:17:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: denode.h,v 1.24 2014/07/08 09:21:52 hannken Exp $	*/
+/*	$NetBSD: denode.h,v 1.25 2017/01/14 17:17:53 maya Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -212,7 +212,8 @@ struct denode {
 #define DE_INTERNALIZE32(dep, dp)			\
 	 ((dep)->de_StartCluster |= getushort((dp)->deHighClust) << 16)
 #define DE_INTERNALIZE(dep, dp)				\
-	(memcpy((dep)->de_Name, (dp)->deName, 11),	\
+	(memcpy((dep)->de_Name, (dp)->deName, 8),	\
+	 memcpy((dep)->de_Name+8, (dp)->deExtension, 3),\
 	 (dep)->de_Attributes = (dp)->deAttributes,	\
 	 (dep)->de_CHun = (dp)->deCHundredth,		\
 	 (dep)->de_CTime = getushort((dp)->deCTime),	\
@@ -229,7 +230,8 @@ struct denode {
 #define DE_EXTERNALIZE16(dp, dep)			\
 	 putushort((dp)->deHighClust, 0)
 #define DE_EXTERNALIZE(dp, dep)				\
-	(memcpy((dp)->deName, (dep)->de_Name, 11),	\
+	(memcpy((dp)->deName, (dep)->de_Name, 8),	\
+	 memcpy((dp)->deExtension, (dep)->de_Name+8, 3),\
 	 (dp)->deAttributes = (dep)->de_Attributes,	\
 	 (dp)->deCHundredth = (dep)->de_CHun,		\
 	 putushort((dp)->deCTime, (dep)->de_CTime),	\

Reply via email to