Module Name: src Committed By: christos Date: Wed Jul 3 14:15:47 UTC 2013
Modified Files: src/libexec/ftpd: cmds.c Log Message: check that stat succeeded before testing the guts of struct stat (Manime Villard) To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/libexec/ftpd/cmds.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/libexec/ftpd/cmds.c diff -u src/libexec/ftpd/cmds.c:1.32 src/libexec/ftpd/cmds.c:1.33 --- src/libexec/ftpd/cmds.c:1.32 Fri Jun 28 11:04:35 2013 +++ src/libexec/ftpd/cmds.c Wed Jul 3 10:15:47 2013 @@ -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 @@ discover_path(char *last_path, const cha 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;