diff options
author | Roger Dingledine <arma@torproject.org> | 2004-11-29 06:49:04 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-11-29 06:49:04 +0000 |
commit | 531c060b3690e5e303f60f8434f4049ebaa8a479 (patch) | |
tree | 7a3d832c0ceefdaa559788c666cb9010e0dd0311 | |
parent | 185f0474509fef19052562b6264fa3ca25bb1bc8 (diff) | |
download | tor-531c060b3690e5e303f60f8434f4049ebaa8a479.tar tor-531c060b3690e5e303f60f8434f4049ebaa8a479.tar.gz |
fix integer underflow in tor_vsnprintf()
(probably exploitable)
svn:r3011
-rw-r--r-- | src/common/compat.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index d46077485..da2b8a143 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -90,12 +90,14 @@ int tor_snprintf(char *str, size_t size, const char *format, ...) return r; } -/** Replacement for vsnpritnf; behavior differs as tor_snprintf differs from +/** Replacement for vsnprintf; behavior differs as tor_snprintf differs from * snprintf. */ 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 */ #ifdef MS_WINDOWS r = _vsnprintf(str, size, format, args); #else |