aboutsummaryrefslogtreecommitdiff
path: root/src/or/buffers.c
AgeCommit message (Collapse)Author
2017-09-11Fix GCC 7 -Wimplicit-fallthrough warningsAndreas Stieger
Add magic comments recognized by default -Wimplicit-fallthrough=3 or break, as required.
2016-10-17Update the buffer sentinel fix to work with our #20081 fix.Nick Mathewson
2016-10-17Merge branch 'maint-0.2.8'Nick Mathewson
2016-10-17Merge branch 'buf_sentinel_026_v2' into maint-0.2.8Nick Mathewson
2016-10-17Add a one-word sentinel value of 0x0 at the end of each buf_t chunkNick Mathewson
This helps protect against bugs where any part of a buf_t's memory is passed to a function that expects a NUL-terminated input. It also closes TROVE-2016-10-001 (aka bug 20384).
2016-10-17Write a bunch of module documentation.Nick Mathewson
This commit adds or improves the module-level documenation for: buffers.c circuitstats.c command.c connection_edge.c control.c cpuworker.c crypto_curve25519.c crypto_curve25519.h crypto_ed25519.c crypto_format.c dircollate.c dirserv.c dns.c dns_structs.h fp_pair.c geoip.c hibernate.c keypin.c ntmain.c onion.c onion_fast.c onion_ntor.c onion_tap.c periodic.c protover.c protover.h reasons.c rephist.c replaycache.c routerlist.c routerparse.c routerset.c statefile.c status.c tor_main.c workqueue.c In particular, I've tried to explain (for each documented module) what each module does, what's in it, what the big idea is, why it belongs in Tor, and who calls it. In a few cases, I've added TODO notes about refactoring opportunities. I've also renamed an argument, and fixed a few DOCDOC comments.
2016-09-13Make preferred_chunk_size avoid overflow, handle big inputs betterNick Mathewson
Also, add tests for the function. Closes 20081; bugfix on 0.2.0.16-alpha. This is a Guido Vranken issue. Thanks, Guido!
2016-08-12Merge remote-tracking branch 'public/Fix_19450'Nick Mathewson
2016-08-02Remove generic_buffer_*() functions as needless.Nick Mathewson
These functions were there so that we could abstract the differences between evbuffer and buf_t. But with the bufferevent removal, this no longer serves a purpose.
2016-08-02Rename generic_buffer_set_to_copy, since generic buffers are not a thingNick Mathewson
2016-07-19Use coarse monotonic timer instead of cached monotonized libevent time.Nick Mathewson
2016-07-14Remove bufferevents dead codeU+039b
Signed-off-by: U+039b <*@0x39b.fr>
2016-05-30Replace nearly all XXX0vv comments with smarter onesNick Mathewson
So, back long ago, XXX012 meant, "before Tor 0.1.2 is released, we had better revisit this comment and fix it!" But we have a huge pile of such comments accumulated for a large number of released versions! Not cool. So, here's what I tried to do: * 0.2.9 and 0.2.8 are retained, since those are not yet released. * XXX+ or XXX++ or XXX++++ or whatever means, "This one looks quite important!" * The others, after one-by-one examination, are downgraded to plain old XXX. Which doesn't mean they aren't a problem -- just that they cannot possibly be a release-blocking problem.
2016-04-15Disambiguate: Avoid defining two static functions called chunk_free_uncheckedNick Mathewson
2016-02-27Update the copyright year.Nick Mathewson
2016-02-27Make sure that every module in src/or has a brief description.Nick Mathewson
2016-01-12Add another safe_str_client to fix bug 17419Nick Mathewson
2015-12-15Replace usage of INLINE with inlinecypherpunks
This patch was generated using; sed -i -e "s/\bINLINE\b/inline/" src/*/*.[ch] src/*/*/*.[ch]
2015-09-02Remove remaining references to "nulterminate" in commentsNick Mathewson
Thanks to Roger for spotting this!
2015-09-01Remove the unused "nulterminate" option to buf_pullup()Nick Mathewson
I was going to add a test for this, but I realized that it had no users. So, removed.
2015-08-25Log malformed hostnames in socks5 request respecting SafeLoggingAndreas Stieger
2015-05-07Merge branch 'writing_tests'Nick Mathewson
2015-05-07Write the outlines of a WritingTests.txt documentNick Mathewson
Also, add some sample tests to be examples.
2015-03-14Remove relative paths to header files.cypherpunks
The paths are already in the directory search path of the compiler therefore no need to include them in the source code.
2015-03-09Merge remote-tracking branch 'origin/maint-0.2.5' into maint-0.2.6Nick Mathewson
2015-03-09Merge remote-tracking branch 'origin/maint-0.2.4' into maint-0.2.5Nick Mathewson
2015-03-09Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4Nick Mathewson
2015-03-03Make the assert related to 15083 a tiny bit more tolerantNick Mathewson
2015-03-03Do not leave empty, invalid chunks in buffers during buf_pullupNick Mathewson
This fixes an assertion failure bug in 15083; bugfix on 0.2.0.10-alpha. Patch from 'cypherpunks'
2015-02-11Remove mempools and buf freelistsNick Mathewson
They have been off-by-default since 0.2.5 and nobody has complained. :) Also remove the buf_shrink() function, which hasn't done anything since we first stopped using contiguous memory to store buffers. Closes ticket 14848.
2015-01-02Bump copyright dates to 2015, in case someday this matters.Nick Mathewson
2014-12-30Allow IPv4 and IPv6 addresses in SOCKS5 FQDN requests.Yawning Angel
Supposedly there are a decent number of applications that "support" IPv6 and SOCKS5 using the FQDN address type. While said applications should be using the IPv6 address type, allow the connection if SafeSocks is not set. Bug not in any released version.
2014-11-27Merge remote-tracking branch 'andrea/cmux_refactor_configurable_threshold'Nick Mathewson
Conflicts: src/or/or.h src/test/Makefile.nmake
2014-11-04Merge branch 'bug13315_squashed'Nick Mathewson
Conflicts: src/or/buffers.c
2014-11-04Sending 'Not allowed' error message before closing the connection.rl1987
2014-11-04Checking if FQDN is actually IPv6 address string and handling that case.rl1987
2014-11-04Validating SOCKS5 hostname more correctly.rl1987
2014-10-28Add another year to our copyright dates.Nick Mathewson
Because in 95 years, we or our successors will surely care about enforcing the BSD license terms on this code. Right?
2014-10-23Fix minor typos, two line lengths, and a repeated includeteor
2014-10-01Send back SOCKS5 errors for all of the address related failures.Yawning Angel
Cases that now send errors: * Malformed IP address (SOCKS5_GENERAL_ERROR) * CONNECT/RESOLVE request with IP, when SafeSocks is set (SOCKS5_NOT_ALLOWED) * RESOLVE_PTR request with FQDN (SOCKS5_ADDRESS_TYPE_NOT_SUPPORTED) * Malformed FQDN (SOCKS5_GENERAL_ERROR) * Unknown address type (SOCKS5_ADDRESS_TYPE_NOT_SUPPORTED) Fixes bug 13314.
2014-09-30Make buf_datalen() mockableAndrea Shepard
2014-09-29Rename socks5 error code setting function againNick Mathewson
I'd prefer not to use the name "send" for any function that doesn't really send things.
2014-09-29Respond with 'Command not supported' SOCKS5 reply message upon reception of ↵rl1987
unsupported request.
2014-05-08Move structures into (private) part of buffers.h so we can inspect them ↵Nick Mathewson
while testing
2014-04-29Make --disable-buf-freelists build and pass unit testsAndrea Shepard
2014-04-18scan-build: check impossible null-pointer case in buffers.cNick Mathewson
When maintaining buffer freelists, we don't skip more than there are, so (*chp) can't be null to begin with. scan-build has no way to know that.
2014-03-05Fix whitespace errors, all of them mine.Nick Mathewson
2014-03-04Merge remote-tracking branch 'public/bug10169_024' into bug10169_025_v2Nick Mathewson
Conflicts: src/common/compat_libevent.h src/or/relay.c
2014-03-04Merge remote-tracking branch 'public/bug10169_023' into bug10169_024Nick Mathewson
Conflicts: src/or/relay.c
2014-02-26Monotonize the OOM-killer data timersNick Mathewson
In a couple of places, to implement the OOM-circuit-killer defense against sniper attacks, we have counters to remember the age of cells or data chunks. These timers were based on wall clock time, which can move backwards, thus giving roll-over results for our age calculation. This commit creates a low-budget monotonic time, based on ratcheting gettimeofday(), so that even in the event of a time rollback, we don't do anything _really_ stupid. A future version of Tor should update this function to do something even less stupid here, like employ clock_gettime() or its kin.