From 9b344628ed8f15543dc7780cc2a5cdd1b8f656cf Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 7 May 2012 12:25:59 -0400 Subject: Handle out-of-range values in tor_parse_* integer functions The underlying strtoX functions handle overflow by saturating and setting errno to ERANGE. If the min/max arguments to the tor_parse_* functions are equal to the minimum/maximum of the underlying type, then with the old approach, we wouldn't treat a too-large value as genuinely broken. Found this while looking at bug 5786; bugfix on 19da1f36 (in Tor 0.0.9), which introduced these functions. --- changes/bug5786_range | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 changes/bug5786_range (limited to 'changes') diff --git a/changes/bug5786_range b/changes/bug5786_range new file mode 100644 index 000000000..40ac4d246 --- /dev/null +++ b/changes/bug5786_range @@ -0,0 +1,8 @@ + o Minor bugfixes: + - Make our number-parsing functions always treat too-large values + as an error, even when those values exceed the width of the + underlying type. Previously, if the caller provided these + functions with minima or maxima set to the extreme values of the + underlying integer type, these functions would return those + values on overflow rather than treating overflow as an error. + Fix for part of bug 5786; bugfix on Tor 0.0.9. \ No newline at end of file -- cgit v1.2.3