From 9c7eb973a4c94d7b87c4879eb5f21102b30fc7c6 Mon Sep 17 00:00:00 2001 From: christos Date: Wed, 3 Jul 2013 14:15:47 +0000 Subject: [PATCH] check that stat succeeded before testing the guts of struct stat (Manime Villard) --- libexec/ftpd/cmds.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libexec/ftpd/cmds.c b/libexec/ftpd/cmds.c index 181515ae7dea..3fb51b2931cf 100644 --- a/libexec/ftpd/cmds.c +++ b/libexec/ftpd/cmds.c @@ -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 #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 @@ -951,8 +951,8 @@ discover_path(char *last_path, const char *new_path) 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;