Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/vi/common Don't attempt to dereference an uninitiali...



details:   https://anonhg.NetBSD.org/src/rev/8a72c566682a
branches:  trunk
changeset: 581488:8a72c566682a
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Jun 02 04:03:03 2005 +0000

description:
Don't attempt to dereference an uninitialized 'ep' pointer if we can't
make a temporary file to mail to the user.
Detected with gcc -Wuninitialized.

diffstat:

 usr.bin/vi/common/recover.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 72a75e0be802 -r 8a72c566682a usr.bin/vi/common/recover.c
--- a/usr.bin/vi/common/recover.c       Thu Jun 02 03:51:14 2005 +0000
+++ b/usr.bin/vi/common/recover.c       Thu Jun 02 04:03:03 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: recover.c,v 1.9 2005/01/19 01:20:24 mycroft Exp $      */
+/*     $NetBSD: recover.c,v 1.10 2005/06/02 04:03:03 lukem Exp $       */
 
 /*-
  * Copyright (c) 1993, 1994
@@ -16,7 +16,7 @@
 #if 0
 static const char sccsid[] = "@(#)recover.c    10.21 (Berkeley) 9/15/96";
 #else
-__RCSID("$NetBSD: recover.c,v 1.9 2005/01/19 01:20:24 mycroft Exp $");
+__RCSID("$NetBSD: recover.c,v 1.10 2005/06/02 04:03:03 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -360,6 +360,7 @@
        char host[MAXHOSTNAMELEN];
 
        gp = sp->gp;
+       ep = sp->ep;
        if ((pw = getpwuid(uid = getuid())) == NULL) {
                msgq(sp, M_ERR,
                    "062|Information on user id %u not found", uid);
@@ -381,7 +382,6 @@
         * be recovered.  There's an obvious window between the mkstemp call
         * and the lock, but it's pretty small.
         */
-       ep = sp->ep;
        if (file_lock(sp, NULL, NULL, fd, 1) != LOCK_SUCCESS)
                msgq(sp, M_SYSERR, "063|Unable to lock recovery file");
        if (!issync) {



Home | Main Index | Thread Index | Old Index