- 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@
This commit is contained in:
Darren Tucker 2007-06-25 18:32:33 +10:00
parent 7dae3d296e
commit 067263e848
2 changed files with 11 additions and 3 deletions

View File

@ -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 $

5
scp.c
View File

@ -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;
}