diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-04-02 18:22:15 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-04-02 18:22:15 +0000 |
commit | 0cf0e1b2af1052634bc3b0d5ed817cc78cfd2040 (patch) | |
tree | 2ec8566e5419a773da762191c1d867c742a6ed0c /lib | |
parent | c819e5c934e9e280442605dc97e45aa9833cf353 (diff) |
Use SIZE_MAX instead of SIZE_T_MAX, the latter is not POSIX and
remove redundant check on size. ok millert@ deraadt@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdlib/calloc.c | 4 | ||||
-rw-r--r-- | lib/libc/stdlib/malloc.3 | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/stdlib/calloc.c b/lib/libc/stdlib/calloc.c index 7105141db82..43a0d1632ca 100644 --- a/lib/libc/stdlib/calloc.c +++ b/lib/libc/stdlib/calloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: calloc.c,v 1.10 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: calloc.c,v 1.11 2006/04/02 18:22:14 otto Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -38,7 +38,7 @@ calloc(size_t num, size_t size) { void *p; - if (num && size && SIZE_T_MAX / num < size) { + if (num && SIZE_MAX / num < size) { errno = ENOMEM; return NULL; } diff --git a/lib/libc/stdlib/malloc.3 b/lib/libc/stdlib/malloc.3 index 24e6b3bc53b..11318d7ce27 100644 --- a/lib/libc/stdlib/malloc.3 +++ b/lib/libc/stdlib/malloc.3 @@ -30,7 +30,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $OpenBSD: malloc.3,v 1.43 2006/03/26 19:56:08 ray Exp $ +.\" $OpenBSD: malloc.3,v 1.44 2006/04/02 18:22:14 otto Exp $ .\" .Dd August 27, 1996 .Dt MALLOC 3 @@ -100,7 +100,7 @@ If .Fn malloc must be used, be sure to test for overflow: .Bd -literal -offset indent -if (num && size && SIZE_T_MAX / num < size) { +if (num && SIZE_MAX / num < size) { errno = ENOMEM; err(1, "overflow"); } |