[tz] [PATCH] * zic.c (growalloc): Fix typos in size calculation and diagnostic.

Paul Eggert eggert at CS.UCLA.EDU
Fri Mar 21 03:21:43 UTC 2014


---
 zic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/zic.c b/zic.c
index 09fda7a..34b3dc1 100644
--- a/zic.c
+++ b/zic.c
@@ -400,8 +400,8 @@ growalloc(void *ptr, size_t itemsize, int nitems, int *nitems_alloc)
 		return ptr;
 	else {
 		int amax = INT_MAX < SIZE_MAX ? INT_MAX : SIZE_MAX;
-		if ((amax - 1) / 2 < *nitems_alloc)
-			memory_exhausted("int ooverflow");
+		if ((amax - 1) / 3 * 2 < *nitems_alloc)
+			memory_exhausted("int overflow");
 		*nitems_alloc = *nitems_alloc + (*nitems_alloc >> 1) + 1;
 		return erealloc(ptr, size_product(*nitems_alloc, itemsize));
 	}
-- 
1.8.5.3




More information about the tz mailing list