From 067263e84800c4b35f9bbbfafdd92aea493b6e0b Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Mon, 25 Jun 2007 18:32:33 +1000 Subject: [PATCH] - djm@cvs.openbsd.org 2007/06/13 00:21:27 [scp.c] don't ftruncate() non-regular files; bz#1236 reported by wood AT xmission.com; ok dtucker@ --- ChangeLog | 9 ++++++++- scp.c | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08d55cc54..d1a244abf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +20070625 + - (dtucker) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2007/06/13 00:21:27 + [scp.c] + don't ftruncate() non-regular files; bz#1236 reported by wood AT + xmission.com; ok dtucker@ + 20070614 - (dtucker) [cipher-ctr.c umac.c openbsd-compat/openssl-compat.h] Move the USE_BUILTIN_RIJNDAEL compat goop to openssl-compat.h so it can be @@ -3072,4 +3079,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.4702 2007/06/14 13:47:31 dtucker Exp $ +$Id: ChangeLog,v 1.4703 2007/06/25 08:32:33 dtucker Exp $ diff --git a/scp.c b/scp.c index 92a67b733..0206e6f4e 100644 --- a/scp.c +++ b/scp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scp.c,v 1.158 2007/06/12 13:54:28 dtucker Exp $ */ +/* $OpenBSD: scp.c,v 1.159 2007/06/13 00:21:27 djm Exp $ */ /* * scp - secure remote copy. This is basically patched BSD rcp which * uses ssh to do the data transfer (instead of using rcmd). @@ -1024,7 +1024,8 @@ bad: run_err("%s: %s", np, strerror(errno)); wrerr = YES; wrerrno = errno; } - if (wrerr == NO && ftruncate(ofd, size) != 0) { + if (wrerr == NO && (!exists || S_ISREG(stb.st_mode)) && + ftruncate(ofd, size) != 0) { run_err("%s: truncate: %s", np, strerror(errno)); wrerr = DISPLAYED; }