Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/msdosfs Be explicit about how we're placing part of t...



details:   https://anonhg.NetBSD.org/src/rev/4533da98a1d1
branches:  trunk
changeset: 350614:4533da98a1d1
user:      maya <maya%NetBSD.org@localhost>
date:      Sat Jan 14 17:17:53 2017 +0000

description:
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

diffstat:

 sys/fs/msdosfs/denode.h |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 8f9a051a67c0 -r 4533da98a1d1 sys/fs/msdosfs/denode.h
--- a/sys/fs/msdosfs/denode.h   Sat Jan 14 17:14:23 2017 +0000
+++ b/sys/fs/msdosfs/denode.h   Sat Jan 14 17:17:53 2017 +0000
@@ -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 @@
 #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 @@
 #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),     \



Home | Main Index | Thread Index | Old Index