tor/src
Nick Mathewson 96d2a21683 Avoid sign-extending when computing rend auth type.
Right-shifting negative values has implementation-defined behavior.
On all the platforms we work on right now, the behavior is to
sign-extend the input.  That isn't what we wanted in

    auth_type_val = (descriptor_cookie_tmp[16] >> 4) + 1;

Fix for 6861; bugfix on 0.2.1.5-alpha; reported pseudonymously.

The broken behavior didn't actually hurt anything, I think, since the
only way to get sign-extension to happen would be to have the top bit
of descriptor_cookie_tmp[16] set, which would make the value of
descriptor_cookie_tmp[16] >> 4 somewhere between 0b11111111 and
0b11111000 (that is, between -1 and -8).  So auth_type_val would be
between -7 and 0.  And the immediate next line does:

    if (auth_type_val < 1 || auth_type_val > 2) {

So the incorrectly computed auth_type_val would be rejected as
invalid, just as a correctly computed auth_type_val would be.

Still, this stuff shouldn't sit around the codebase.
2012-09-17 10:28:14 -04:00
..
common Merge remote-tracking branch 'origin/maint-0.2.3' 2012-09-14 12:40:23 -04:00
config Revert "6819: typo in torrc.sample.in" 2012-09-12 15:37:47 -04:00
or Avoid sign-extending when computing rend auth type. 2012-09-17 10:28:14 -04:00
test Remove a duplicate test in test_util_pow2 2012-09-14 10:00:47 -04:00
tools Fix some bugs that did not allow compilation on Windows. 2012-09-05 18:23:29 +03:00
win32 Bump version to 0.2.4.2-alpha-dev 2012-09-10 19:49:20 -04:00
include.am Move to non-recursive make 2012-08-09 11:03:47 -04:00