[openssh-commits] [openssh] 01/04: upstream commit

git+noreply at mindrot.org git+noreply at mindrot.org
Sat Aug 22 11:17:12 AEST 2015


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit e774e5ea56237fd626a8161f9005023dff3e76c9
Author: deraadt at openbsd.org <deraadt at openbsd.org>
Date:   Fri Aug 21 23:29:31 2015 +0000

    upstream commit
    
    Improve size == 0, count == 0 checking in mm_zalloc,
     which is "array" like. Discussed with tedu, millert, otto.... and ok djm
    
    Upstream-ID: 899b021be43b913fad3eca1aef44efe710c53e29
---
 monitor.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/monitor.c b/monitor.c
index a914209..9348983 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.150 2015/06/22 23:42:16 djm Exp $ */
+/* $OpenBSD: monitor.c,v 1.151 2015/08/21 23:29:31 deraadt Exp $ */
 /*
  * Copyright 2002 Niels Provos <provos at citi.umich.edu>
  * Copyright 2002 Markus Friedl <markus at openbsd.org>
@@ -487,15 +487,10 @@ monitor_sync(struct monitor *pmonitor)
 static void *
 mm_zalloc(struct mm_master *mm, u_int ncount, u_int size)
 {
-	size_t len = (size_t) size * ncount;
-	void *address;
-
-	if (len == 0 || ncount > SIZE_MAX / size)
+	if (size == 0 || ncount == 0 || ncount > SIZE_MAX / size)
 		fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size);
 
-	address = mm_malloc(mm, len);
-
-	return (address);
+	return mm_malloc(mm, size * ncount);
 }
 
 static void

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list