Source-Changes-HG archive

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

[src/trunk]: src/sbin/fsck_msdos Prevent SEGV on corrupted msdos directories ...



details:   https://anonhg.NetBSD.org/src/rev/872c46a7f8ae
branches:  trunk
changeset: 823608:872c46a7f8ae
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 28 11:33:00 2017 +0000

description:
Prevent SEGV on corrupted msdos directories (Veo Zhang)

diffstat:

 sbin/fsck_msdos/dir.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r dce3ba1b37cc -r 872c46a7f8ae sbin/fsck_msdos/dir.c
--- a/sbin/fsck_msdos/dir.c     Fri Apr 28 10:37:41 2017 +0000
+++ b/sbin/fsck_msdos/dir.c     Fri Apr 28 11:33:00 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.28 2016/03/07 14:47:25 christos Exp $        */
+/*     $NetBSD: dir.c,v 1.29 2017/04/28 11:33:00 christos Exp $        */
 
 /*
  * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: dir.c,v 1.28 2016/03/07 14:47:25 christos Exp $");
+__RCSID("$NetBSD: dir.c,v 1.29 2017/04/28 11:33:00 christos Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
@@ -623,7 +623,7 @@
                        dirent.name[8] = '\0';
                        for (k = 7; k >= 0 && dirent.name[k] == ' '; k--)
                                dirent.name[k] = '\0';
-                       if (dirent.name[k] != '\0')
+                       if (k < 0 || dirent.name[k] != '\0')
                                k++;
                        if (dirent.name[0] == SLOT_E5)
                                dirent.name[0] = 0xe5;



Home | Main Index | Thread Index | Old Index