From c1e7e1f3de9cfe6106716fbf965eb99947624508 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Wed, 25 May 2016 15:36:02 +0000 Subject: Avoid a use-after-free. Diff from Vladimir Sotirov via tech@. Thanks! ok millert@ --- usr.bin/ftp/cmds.c | 6 ++---- usr.bin/ftp/small.c | 6 +++++- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index 2b3bc72b79c..9fdd8d25655 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.76 2016/03/17 19:40:43 krw Exp $ */ +/* $OpenBSD: cmds.c,v 1.77 2016/05/25 15:36:01 krw Exp $ */ /* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */ /* @@ -1643,9 +1643,7 @@ void newer(int argc, char *argv[]) { - if (getit(argc, argv, -1, "w")) - fprintf(ttyout, "Local file \"%s\" is newer than remote file \"%s\".\n", - argv[2], argv[1]); + (void)getit(argc, argv, -1, "w"); } /* diff --git a/usr.bin/ftp/small.c b/usr.bin/ftp/small.c index 23f477f565e..a0015a6eff5 100644 --- a/usr.bin/ftp/small.c +++ b/usr.bin/ftp/small.c @@ -1,4 +1,4 @@ -/* $OpenBSD: small.c,v 1.5 2015/10/18 03:04:11 mmcc Exp $ */ +/* $OpenBSD: small.c,v 1.6 2016/05/25 15:36:01 krw Exp $ */ /* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */ /* @@ -275,6 +275,10 @@ usage: goto freegetit; if (stbuf.st_mtime >= mtime) { rval = 1; + fprintf(ttyout, + "Local file \"%s\" is newer "\ + "than remote file \"%s\".\n", + argv[2], argv[1]); goto freegetit; } } -- cgit v1.2.3