diff options
author | Roger Dingledine <arma@torproject.org> | 2004-10-12 20:22:09 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-10-12 20:22:09 +0000 |
commit | 0b4d3c4df792942ef356b985c59c9442f321a272 (patch) | |
tree | 0a8fff309f89a021f23ad51a4af02c9825143d26 /src/or/buffers.c | |
parent | a7d858bd6efe6e5605f02426594e546008f1427c (diff) | |
download | tor-0b4d3c4df792942ef356b985c59c9442f321a272.tar.gz tor-0b4d3c4df792942ef356b985c59c9442f321a272.zip |
parse HttpProxy address in config
fix a potential confusion in fetch_from_buf_http()
make all our int config options non-negative
better bounds checking on options that are ports
svn:r2456
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r-- | src/or/buffers.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index 89dc0fc6b0..98b3e56f57 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -342,6 +342,8 @@ int fetch_from_buf(char *string, size_t string_len, buf_t *buf) { * * - If headers or body is NULL, discard that part of the buf. * - If a headers or body doesn't fit in the arg, return -1. + * (We ensure that the headers or body don't exceed max len, + * _even if_ we're planning to discard them.) * * Else, change nothing and return 0. */ @@ -368,11 +370,11 @@ int fetch_from_buf_http(buf_t *buf, bodylen = buf->datalen - headerlen; log_fn(LOG_DEBUG,"headerlen %d, bodylen %d.", headerlen, bodylen); - if(headers_out && max_headerlen <= headerlen) { + if(max_headerlen <= headerlen) { log_fn(LOG_WARN,"headerlen %d larger than %d. Failing.", headerlen, max_headerlen-1); return -1; } - if(body_out && max_bodylen <= bodylen) { + if(max_bodylen <= bodylen) { log_fn(LOG_WARN,"bodylen %d larger than %d. Failing.", bodylen, max_bodylen-1); return -1; } |