summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-04-23 12:06:49 +1000
committerDamien Miller <djm@mindrot.org>2006-04-23 12:06:49 +1000
commitb5ea7e7c037be2702fa1664b762aff2e019dcb0e (patch)
treecbf2ef7cf131261a5862aec2f0c5ee09f544650d
parent58ca98bfe12b65f4d445dc05b422f672c51caa4b (diff)
- djm@cvs.openbsd.org 2006/04/16 07:59:00
[atomicio.c] reorder sanity test so that it cannot dereference past the end of the iov array; well spotted canacar@!
-rw-r--r--ChangeLog6
-rw-r--r--atomicio.c4
2 files changed, 7 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 0a597a4fe..b2a607098 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,10 @@
37 commands, which would result in a separate tiny packet on the wire by 37 commands, which would result in a separate tiny packet on the wire by
38 using atomiciov(writev, ...) to write the length and the command in one 38 using atomiciov(writev, ...) to write the length and the command in one
39 pass; ok deraadt@ 39 pass; ok deraadt@
40 - djm@cvs.openbsd.org 2006/04/16 07:59:00
41 [atomicio.c]
42 reorder sanity test so that it cannot dereference past the end of the
43 iov array; well spotted canacar@!
40 44
4120060421 4520060421
42 - (djm) [Makefile.in configure.ac session.c sshpty.c] 46 - (djm) [Makefile.in configure.ac session.c sshpty.c]
@@ -4548,4 +4552,4 @@
4548 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 4552 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
4549 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 4553 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
4550 4554
4551$Id: ChangeLog,v 1.4309 2006/04/23 02:06:35 djm Exp $ 4555$Id: ChangeLog,v 1.4310 2006/04/23 02:06:49 djm Exp $
diff --git a/atomicio.c b/atomicio.c
index de5363aa3..3939785df 100644
--- a/atomicio.c
+++ b/atomicio.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: atomicio.c,v 1.18 2006/04/16 00:52:55 djm Exp $ */ 1/* $OpenBSD: atomicio.c,v 1.19 2006/04/16 07:59:00 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2006 Damien Miller. All rights reserved. 3 * Copyright (c) 2006 Damien Miller. All rights reserved.
4 * Copyright (c) 2005 Anil Madhavapeddy. All rights reserved. 4 * Copyright (c) 2005 Anil Madhavapeddy. All rights reserved.
@@ -99,7 +99,7 @@ atomiciov(ssize_t (*f) (int, const struct iovec *, int), int fd,
99 iovcnt--; 99 iovcnt--;
100 } 100 }
101 /* This shouldn't happen... */ 101 /* This shouldn't happen... */
102 if (rem > iov[0].iov_len || (rem > 0 && iovcnt <= 0)) { 102 if (rem > 0 && (iovcnt <= 0 || rem > iov[0].iov_len)) {
103 errno = EFAULT; 103 errno = EFAULT;
104 return 0; 104 return 0;
105 } 105 }