Nick Mathewson
9f25a5529a
Fix an assertion-failure in memarea_alloc() on 64-bit platforms.
...
The trick is that we should assert that our next_mem pointer has not
run off the end of the array _before_ we realign the pointer, since
doing that could take us over the end... but only if we're on a system
where malloc() gives us ram in increments smaller than sizeof(void*).
2009-05-17 00:02:59 -04:00
Nick Mathewson
c36efb0c45
Use a mutex to protect the count of open sockets.
...
This matters because a cpuworker can close its socket when it
finishes. Cpuworker typically runs in another thread, so without a
lock here, we can have a race condition and get confused about how
many sockets are open. Possible fix for bug 939.
2009-05-13 09:38:48 -04:00
Karsten Loesing
9b32e8c141
Update copyright to 2009.
2009-05-04 11:28:27 -04:00
Nick Mathewson
be9d72303e
Actually do that memarea_strndup fix right. Not only must you not examine unmapped ram, but you also must not copy it. From lark.
...
svn:r19095
2009-03-21 16:01:52 +00:00
Nick Mathewson
0fa01654b9
fix from lark: make memarea_strndup() work even at the end of a mmap chunk. Bug was harmless for now, I think.
...
svn:r19094
2009-03-21 11:52:53 +00:00
Nick Mathewson
cb3b95de19
Add some asserts to try to catch bug 930
...
svn:r19074
2009-03-18 15:12:56 +00:00
Roger Dingledine
2f69c67957
doxygen tweak
...
svn:r18818
2009-03-09 06:20:15 +00:00
Nick Mathewson
cbbc0c9c86
Actually use tor_sscanf() to parse untrusted input.
...
svn:r18761
2009-03-03 18:02:36 +00:00
Nick Mathewson
26d83fc04c
Add a simple locale-independent no-surprises sscanf replacement.
...
tor_sscanf() only handles %u and %s for now, which will make it
adequate to replace sscanf() for date/time/IP parsing. We want this
to prevent attackers from constructing weirdly formed descriptors,
cells, addresses, HTTP responses, etc, that validate under some
locales but not others.
svn:r18760
2009-03-03 18:02:31 +00:00
Nick Mathewson
9f8d095e0f
Add and use set/get_uint64 on onion tags. [bug 604; backportable]
...
It seems that 64-bit Sparc Solaris demands 64-bit-aligned access to
uint64_t, but does not 64-bit-align the stack-allocated char array we
use for cpuworker tags. So this patch adds a set/get_uint64 pair, and
uses them to access the conn_id field in the tag.
svn:r18743
2009-03-02 19:15:05 +00:00
Nick Mathewson
f99098cca4
Use prctl to reenable core dumps when we have setuid to a non-root user.
...
svn:r18449
2009-02-09 15:20:17 +00:00
Nick Mathewson
fe987d3a17
Remove some deadcode and use tor_inet_aton uniformly.
...
svn:r18422
2009-02-09 03:13:05 +00:00
Nick Mathewson
72e420ff3c
Fix typo found by Justin Coffi on or-talk
...
svn:r18258
2009-01-23 22:45:08 +00:00
Nick Mathewson
25c6ff6f55
Support 64-bit time_t. Patch from Matthias Drochner. Partial backport candidate.
...
svn:r18234
2009-01-22 16:28:12 +00:00
Nick Mathewson
8ebceeb352
Make sure that even in the weird fiddly paths that lead to init_keys,
...
crypto_global_init gets called. Also have it be crypto_global_init
that calls crypto_seed_rng, so we are not dependent on OpenSSL's
RAND_poll in these fiddly cases.
Should fix bug 907. Bugfix on 0.0.9pre6. Backport candidate.
svn:r18210
2009-01-21 15:38:39 +00:00
Nick Mathewson
bf2b71beb8
Fix an error in tor_addr_parse that kept us from having a hidden service or a bridge live at an IPv6 address.
...
svn:r18206
2009-01-21 07:24:50 +00:00
Nick Mathewson
3f8ab367c1
Fix warning on panther compile, and bug 913. Backport candidate.
...
svn:r18203
2009-01-21 03:51:14 +00:00
Nick Mathewson
a87980c2eb
Add a better (non-locale-having) ctypes implementation to avoid protocol and parsing mismatches on different platforms.
...
svn:r18189
2009-01-20 21:33:56 +00:00
Nick Mathewson
a33452c401
Fix up (I hope) most ot the things that coverity suddenly claimed were REVERSE_INULL. This is what we get for bragging about being down to 0 issues.
...
svn:r18096
2009-01-13 14:43:51 +00:00
Nick Mathewson
943626050c
Fix a leak memory on the failing case of test_memeq_hex
...
svn:r18094
2009-01-13 14:43:43 +00:00
Nick Mathewson
0fe5ce423a
Fix a harmless-to-us bug in ht.h.
...
There was a field that _HT_FOI_INSERT was never setting. Everything that calls _HT_FOI_INSERT was setting it via tor_malloc_zero, but that's fragile.
svn:r18064
2009-01-10 14:40:43 +00:00
Nick Mathewson
585d4a12b5
Note a problem in the interface tor_addr_to_sockaddr.
...
svn:r17982
2009-01-06 20:50:51 +00:00
Nick Mathewson
765bb14f69
Another fun openbsd warning fix. On ioerror's computer at least, they redefined an unsigned field in zlib.h to be signed. I am quite sure this makes me more secure somehow.
...
svn:r17892
2009-01-04 23:15:42 +00:00
Nick Mathewson
743c6c8277
OpenBSD malloc.h believes that you should be able to detect headers with autoconf, or build without warnings, but not both. So never include malloc.h on OpenBSD. Backport candidate.
...
svn:r17891
2009-01-04 22:47:42 +00:00
Nick Mathewson
9c94b428d9
Fix the oldest bug in a while: stop accepting 1.2.3 as a valid IPv4 address on any platform.
...
svn:r17887
2009-01-04 19:47:17 +00:00
Nick Mathewson
c4b8fef362
Remove svn $Id$s from our source, and remove tor --version --version.
...
The subversion $Id$ fields made every commit force a rebuild of
whatever file got committed. They were not actually useful for
telling the version of Tor files in the wild.
svn:r17867
2009-01-04 00:35:51 +00:00
Nick Mathewson
9c20441bcb
Only set sin_len/sin6_len when they exist.
...
svn:r17851
2009-01-02 20:57:10 +00:00
Nick Mathewson
48f2ce298b
Try harder to make sure we zero-out the extraneous sockaddr fields and that we set sockaddr_len. Conceivably a backport candidate, though nothing has yet been sen to break.
...
svn:r17849
2009-01-02 20:39:38 +00:00
Nick Mathewson
52932d6f1a
Remove some code that is #ifdefed out, and that we no longer seem to use, if we ever did.
...
svn:r17827
2008-12-30 04:16:49 +00:00
Nick Mathewson
e8a3fa91a6
Use a consistent naming standard for header file guard macros, taking care not to collide with any system headers. This tripped us up on Android.
...
svn:r17805
2008-12-29 02:21:02 +00:00
Nick Mathewson
b0a8ecd193
Use RSA_generate_key_ex where available.
...
svn:r17804
2008-12-29 02:20:57 +00:00
Nick Mathewson
94507f1b6d
Fix bug in recent address.c patch: actually set the value of address * to 0.0.0.0 as we did before. This makes CMP_EXACT comparisons with bitmask 0 work on address * again.
...
svn:r17801
2008-12-29 01:30:35 +00:00
Nick Mathewson
ccda4e481c
Fix compilation under gethostbyname-based systems.
...
svn:r17800
2008-12-27 15:46:16 +00:00
Nick Mathewson
374c1e979f
Refactor tor_addr_t manipulation functions so that as few as possible look at the tor_addr_t representation.
...
svn:r17790
2008-12-26 21:26:05 +00:00
Nick Mathewson
616f6643ef
get_interface_addr6(), and by extension get_interface_addr(), were pretty borked. Copying a tor_addr_t from a sockaddr_storage using memcpy is a poor notion.
...
svn:r17789
2008-12-26 21:26:03 +00:00
Nick Mathewson
61722638ea
Refactor tor_addr_compare_masked() so that CMP_SEMANTIC makes more sense, and has decent semantics for maskbits; and so that CMP_EXACT works right for bits==0.
...
svn:r17788
2008-12-26 20:37:18 +00:00
Nick Mathewson
73e1a1d26e
Document our Bloom filter parameter choices.
...
svn:r17785
2008-12-26 17:35:18 +00:00
Nick Mathewson
df5e8f65bc
Add more missing documentation, and correct an error in container.c documentation: Don't introduce two parameters called n when you're calling an algorithm O(n).
...
svn:r17783
2008-12-26 17:35:08 +00:00
Roger Dingledine
a12c3f2c86
some fixes i found in my sandbox
...
svn:r17771
2008-12-25 15:37:47 +00:00
Nick Mathewson
558e9899e4
Document most undocumented variables.
...
svn:r17754
2008-12-23 17:56:31 +00:00
Nick Mathewson
d7f55dafe0
Properly zero-out addresses when setting them. Probably this was not hurting anything.
...
svn:r17749
2008-12-23 14:21:34 +00:00
Nick Mathewson
b4d387c28b
Make freelist_len in memarea.c static; document a few variables.
...
svn:r17741
2008-12-22 19:14:08 +00:00
Nick Mathewson
b68379b13b
Add DOCDOC entries for undocumented static and global variables.
...
svn:r17739
2008-12-22 19:00:05 +00:00
Nick Mathewson
1e5f457461
Fix most DOCDOCs remaining and/or added by redox.
...
svn:r17734
2008-12-22 17:53:04 +00:00
Nick Mathewson
1725c0c8a5
Add DOCDOC comments for all undocumented functions. Add missing *s to other comments so that they will get recognized as doxygen.
...
svn:r17729
2008-12-22 14:56:28 +00:00
Nick Mathewson
55348884b5
Fix all of the doxygen warnings not pertaining to missing documentation.
...
svn:r17727
2008-12-22 14:56:16 +00:00
Nick Mathewson
029be5ad02
Move in-addr.arpa parsing and generation into address.c, and simplify the code that does it elsewhere. Incidentally, this lets exit servers answer requests for ip6.arpa addresses.
...
svn:r17707
2008-12-19 18:52:00 +00:00
Nick Mathewson
efb863189c
Expose hex_decode_digit from util.c
...
svn:r17706
2008-12-19 18:51:52 +00:00
Nick Mathewson
bf80e2df3f
Replace calls to time(NULL) that occur on the order of once per read, one per write, or once per cell with calls to a function that looks at a cached value of time. This is tricksy to benchmark, since it will only help on systems where time() is a syscall and syscalls are relatively slow.
...
svn:r17690
2008-12-18 17:19:04 +00:00
Nick Mathewson
b6f89a647a
One log.c XXX021 was a misunderstanding. Also, clip log messages passed to syslog to their maximum length when there is a maximum.
...
svn:r17688
2008-12-18 17:18:06 +00:00