diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-12-02 04:33:01 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-12-02 04:33:01 +0000 |
commit | a980446d0cf8f455c49f6543bd8486b442e326b1 (patch) | |
tree | 2a575e8d2b88971d850174fbe35de613142508d5 /src/common/compat.c | |
parent | db5e100cde18bfb5d35c409f0fbb62e8e7438c38 (diff) | |
download | tor-a980446d0cf8f455c49f6543bd8486b442e326b1.tar.gz tor-a980446d0cf8f455c49f6543bd8486b442e326b1.zip |
Be more proactive about noticing underflows: size_t values greater than 0x800...00 are likely to be trouble.
svn:r3064
Diffstat (limited to 'src/common/compat.c')
-rw-r--r-- | src/common/compat.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index e025bff207..128ff4a2bb 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 |