Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Goulet
Tor
Commits
8cd5a3c1
Commit
8cd5a3c1
authored
Jun 06, 2011
by
Nick Mathewson
🎨
Browse files
Merge remote-tracking branch 'origin/maint-0.2.2'
parents
96da10aa
9e3fc5f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
changes/bug3306
0 → 100644
View file @
8cd5a3c1
o Minor bugfixes:
- Make our crypto_rand_int() function check the value of its input
correctly. Previously, it accepted values up to UINT_MAX, but
could return a negative number if given a value above INT_MAX+1.
Found by George Kadianakis. Fixes bug 3306; bugfix on 0.2.2pre14.
- Avoid a segfault when reading a malformed circuit build state
with more than INT_MAX entries. Found by wanoskarnet. Bugfix on
0.2.2.4-alpha.
src/common/crypto.c
View file @
8cd5a3c1
...
...
@@ -2145,13 +2145,14 @@ crypto_rand(char *to, size_t n)
}
/** Return a pseudorandom integer, chosen uniformly from the values
* between 0 and <b>max</b>-1. */
* between 0 and <b>max</b>-1 inclusive. <b>max</b> must be between 1 and
* INT_MAX+1, inclusive. */
int
crypto_rand_int
(
unsigned
int
max
)
{
unsigned
int
val
;
unsigned
int
cutoff
;
tor_assert
(
max
<
U
INT_MAX
);
tor_assert
(
max
<
=
((
unsigned
int
)
INT_MAX
)
+
1
)
;
tor_assert
(
max
>
0
);
/* don't div by 0 */
/* We ignore any values that are >= 'cutoff,' to avoid biasing the
...
...
src/or/circuitbuild.c
View file @
8cd5a3c1
...
...
@@ -679,7 +679,15 @@ circuit_build_times_shuffle_and_store_array(circuit_build_times_t *cbt,
log_notice
(
LD_CIRC
,
"The number of circuit times that this Tor version "
"uses to calculate build times is less than the number stored "
"in your state file. Decreasing the circuit time history from "
"%d to %d."
,
num_times
,
CBT_NCIRCUITS_TO_OBSERVE
);
"%lu to %d."
,
(
unsigned
long
)
num_times
,
CBT_NCIRCUITS_TO_OBSERVE
);
}
if
(
n
>
INT_MAX
-
1
)
{
log_warn
(
LD_CIRC
,
"For some insane reasons, you had %lu circuit build "
"observations in your state file. That's far too many; probably "
"there's a bug here."
,
(
unsigned
long
)
n
);
n
=
INT_MAX
-
1
;
}
/* This code can only be run on a compact array */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment