summaryrefslogtreecommitdiff
path: root/wrapper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-02-10 14:45:55 -0800
committerJunio C Hamano <gitster@pobox.com>2011-02-10 14:45:55 -0800
commitb308bf18633964102472db5065929a359d4ad265 (patch)
treead03f24d6bcaa3228f20f0141e73bdadffaf3cda /wrapper.c
parent1a9fe453263137be7d42e6fbfc041b5b2d9521d7 (diff)
parent1368f65002bf39fdde7dd736a75ae35475184371 (diff)
downloadgit-b308bf18633964102472db5065929a359d4ad265.tar.gz
Merge branch 'maint'
* maint: compat: helper for detecting unsigned overflow
Diffstat (limited to 'wrapper.c')
-rw-r--r--wrapper.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/wrapper.c b/wrapper.c
index 55b074ec46..4c147d6c48 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -53,7 +53,7 @@ void *xmalloc(size_t size)
void *xmallocz(size_t size)
{
void *ret;
- if (size + 1 < size)
+ if (unsigned_add_overflows(size, 1))
die("Data too large to fit into virtual memory space.");
ret = xmalloc(size + 1);
((char*)ret)[size] = 0;