[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/maint-0.2.2] Increase the length of the buffer in smartlist_string_num_isin().



commit 83fe07d3f26aff703230305c9ff529592af32d4f
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Sun May 15 22:13:53 2011 -0400

    Increase the length of the buffer in smartlist_string_num_isin().
    
    This was harmless, since we only used this for checking for lists of
    port values, but it's the principle of the thing.
    
    Fixes 3175; bugfix on 0.1.0.1-rc
---
 changes/bug3175        |    7 +++++++
 src/common/container.c |    2 +-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/changes/bug3175 b/changes/bug3175
new file mode 100644
index 0000000..3360fbc
--- /dev/null
+++ b/changes/bug3175
@@ -0,0 +1,7 @@
+  o Minor bugfixes:
+    - Resolve an untriggerable issue in smartlist_string_num_isin(),
+      where if the function had ever in the future been used to check
+      for the presence of a too-large number, it would have given an
+      incorrect result.  (Fortunately, we only used it for 16-bit
+      values.)  Fixes bug 3175; bugfix on Tor 0.1.0.1-rc.
+
diff --git a/src/common/container.c b/src/common/container.c
index ca49cbb..da44b7f 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -210,7 +210,7 @@ smartlist_string_isin_case(const smartlist_t *sl, const char *element)
 int
 smartlist_string_num_isin(const smartlist_t *sl, int num)
 {
-  char buf[16];
+  char buf[32]; /* long enough for 64-bit int, and then some. */
   tor_snprintf(buf,sizeof(buf),"%d", num);
   return smartlist_string_isin(sl, buf);
 }

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits