[tor-commits] [tor/master] removed PARAM_LEN

nickm at torproject.org nickm at torproject.org
Fri Sep 13 16:31:56 UTC 2013


commit 8b8f87a06ad5f18460012d0a0b4ceaa119bbccd3
Author: Cristian Toader <cristian.matei.toader at gmail.com>
Date:   Wed Aug 28 19:56:42 2013 +0300

    removed PARAM_LEN
---
 src/common/sandbox.c |    9 +++------
 src/common/sandbox.h |    3 ---
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/common/sandbox.c b/src/common/sandbox.c
index 50d6f99..8ef8757 100644
--- a/src/common/sandbox.c
+++ b/src/common/sandbox.c
@@ -669,7 +669,7 @@ sandbox_intern_string(const char *param)
     return NULL;
 
   for (elem = filter_dynamic; elem != NULL; elem = elem->next) {
-    if (elem->prot && !strncmp(param, (char*)(elem->param), MAX_PARAM_LEN)) {
+    if (elem->prot && !strcmp(param, (char*)(elem->param))) {
       return (char*)(elem->param);
     }
   }
@@ -688,10 +688,7 @@ prot_strdup(char* str)
     goto out;
 
   // allocating protected memory region for parameter
-  param_size = 1 + strnlen(str, MAX_PARAM_LEN);
-  if (param_size == MAX_PARAM_LEN) {
-    log_warn(LD_BUG, "(Sandbox) Parameter length too large!");
-  }
+  param_size = 1 + strlen(str);
 
   res = (char*) mmap(NULL, param_size, PROT_READ | PROT_WRITE, MAP_PRIVATE |
       MAP_ANON, -1, 0);
@@ -903,7 +900,7 @@ sandbox_getaddrinfo(const char *name, struct addrinfo **res)
     return -1;
   }
 
-  if (strncmp(name, hname, sizeof(hname)) || sb_addr_info == NULL) {
+  if (strcmp(name, hname) || sb_addr_info == NULL) {
     log_err(LD_BUG,"(Sandbox) failed for hname %s!", name);
     return -1;
   }
diff --git a/src/common/sandbox.h b/src/common/sandbox.h
index 6cb827e..a844fc5 100644
--- a/src/common/sandbox.h
+++ b/src/common/sandbox.h
@@ -36,9 +36,6 @@
 #include <seccomp.h>
 #include <netdb.h>
 
-/** Security measure for filter string parameter lengths*/
-#define MAX_PARAM_LEN 64
-
 #define PARAM_PTR 0
 #define PARAM_NUM 1
 





More information about the tor-commits mailing list