Source-Changes-HG archive

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

[src/trunk]: src/libexec/ftpd check that stat succeeded before testing the gu...



details:   https://anonhg.NetBSD.org/src/rev/b2743120ee55
branches:  trunk
changeset: 787781:b2743120ee55
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jul 03 14:15:47 2013 +0000

description:
check that stat succeeded before testing the guts of struct stat
(Manime Villard)

diffstat:

 libexec/ftpd/cmds.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 66ec9b9147a4 -r b2743120ee55 libexec/ftpd/cmds.c
--- a/libexec/ftpd/cmds.c       Wed Jul 03 14:01:29 2013 +0000
+++ b/libexec/ftpd/cmds.c       Wed Jul 03 14:15:47 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmds.c,v 1.32 2013/06/28 15:04:35 joerg Exp $  */
+/*     $NetBSD: cmds.c,v 1.33 2013/07/03 14:15:47 christos Exp $       */
 
 /*
  * Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: cmds.c,v 1.32 2013/06/28 15:04:35 joerg Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.33 2013/07/03 14:15:47 christos Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -951,8 +951,8 @@
                tp[strlen(tp) - 1] = '\0';
 
        /* check that the path is correct */
-       stat(tp, &st1);
-       stat(".", &st2);
+       if (stat(tp, &st1) == -1 || stat(".", &st2) == -1)
+               goto bad;
        if ((st1.st_dev != st2.st_dev) || (st1.st_ino != st2.st_ino))
                goto bad;
 



Home | Main Index | Thread Index | Old Index