summaryrefslogtreecommitdiff
path: root/xmalloc.c
diff options
context:
space:
mode:
authormillert@openbsd.org <millert@openbsd.org>2015-02-06 23:21:59 +0000
committerDamien Miller <djm@mindrot.org>2015-02-09 09:28:17 +1100
commitfd36834871d06a03e1ff8d69e41992efa1bbf85f (patch)
tree95390638f8f92dfd017176d558acec1e91a9e3b0 /xmalloc.c
parent1910a286d7771eab84c0b047f31c0a17505236fa (diff)
downloadopenssh-git-fd36834871d06a03e1ff8d69e41992efa1bbf85f.tar.gz
upstream commit
SIZE_MAX is standard, we should be using it in preference to the obsolete SIZE_T_MAX. OK miod@ beck@
Diffstat (limited to 'xmalloc.c')
-rw-r--r--xmalloc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/xmalloc.c b/xmalloc.c
index 0a9f282a..fe266cc4 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xmalloc.c,v 1.30 2015/01/16 06:40:12 deraadt Exp $ */
+/* $OpenBSD: xmalloc.c,v 1.31 2015/02/06 23:21:59 millert Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -16,10 +16,10 @@
#include "includes.h"
#include <stdarg.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <limits.h>
#include "xmalloc.h"
#include "log.h"
@@ -44,8 +44,8 @@ xcalloc(size_t nmemb, size_t size)
if (size == 0 || nmemb == 0)
fatal("xcalloc: zero size");
- if (SIZE_T_MAX / nmemb < size)
- fatal("xcalloc: nmemb * size > SIZE_T_MAX");
+ if (SIZE_MAX / nmemb < size)
+ fatal("xcalloc: nmemb * size > SIZE_MAX");
ptr = calloc(nmemb, size);
if (ptr == NULL)
fatal("xcalloc: out of memory (allocating %zu bytes)",
@@ -61,8 +61,8 @@ xrealloc(void *ptr, size_t nmemb, size_t size)
if (new_size == 0)
fatal("xrealloc: zero size");
- if (SIZE_T_MAX / nmemb < size)
- fatal("xrealloc: nmemb * size > SIZE_T_MAX");
+ if (SIZE_MAX / nmemb < size)
+ fatal("xrealloc: nmemb * size > SIZE_MAX");
if (ptr == NULL)
new_ptr = malloc(new_size);
else