From a980446d0cf8f455c49f6543bd8486b442e326b1 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 2 Dec 2004 04:33:01 +0000 Subject: Be more proactive about noticing underflows: size_t values greater than 0x800...00 are likely to be trouble. svn:r3064 --- src/common/compat.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/common/compat.c') diff --git a/src/common/compat.c b/src/common/compat.c index e025bff20..128ff4a2b 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -100,6 +100,8 @@ int tor_vsnprintf(char *str, size_t size, const char *format, va_list args) int r; if (size == 0) return -1; /* no place for the NUL */ + if (size > SIZE_T_CEILING) + return -1; #ifdef MS_WINDOWS r = _vsnprintf(str, size, format, args); #else -- cgit v1.2.3