Преглед изворни кода

passing hints as a const pointer to sandbox_getaddrinfo(), also one tor_free macro fails to compile..

Cristian Toader пре 10 година
родитељ
комит
6a22b29641
3 измењених фајлова са 5 додато и 5 уклоњено
  1. 1 1
      src/common/address.c
  2. 3 3
      src/common/sandbox.c
  3. 1 1
      src/common/sandbox.h

+ 1 - 1
src/common/address.c

@@ -235,7 +235,7 @@ tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr)
     memset(&hints, 0, sizeof(hints));
     hints.ai_family = family;
     hints.ai_socktype = SOCK_STREAM;
-    err = sandbox_getaddrinfo(name, hints, &res);
+    err = sandbox_getaddrinfo(name, &hints, &res);
     if (!err) {
       best = NULL;
       for (res_p = res; res_p; res_p = res_p->ai_next) {

+ 3 - 3
src/common/sandbox.c

@@ -728,7 +728,7 @@ prot_strings(sandbox_cfg_t* cfg)
       memcpy(pr_mem_next, param_val, param_size);
 
       // re-point el parameter to protected
-      tor_free((char*) ((smp_param_t*)el->param)->value);
+      free((char*)((smp_param_t*)el->param)->value);
       ((smp_param_t*)el->param)->value = (intptr_t) pr_mem_next;
       ((smp_param_t*)el->param)->prot = 1;
 
@@ -949,7 +949,7 @@ sandbox_cfg_allow_execve_array(sandbox_cfg_t **cfg, ...)
 }
 
 int
-sandbox_getaddrinfo(const char *name, struct addrinfo hints,
+sandbox_getaddrinfo(const char *name, const struct addrinfo *hints,
     struct addrinfo **res)
 {
   sb_addr_info_t *el;
@@ -969,7 +969,7 @@ sandbox_getaddrinfo(const char *name, struct addrinfo hints,
   }
 
   if (!sandbox_active) {
-    if (getaddrinfo(name, NULL, &hints, res)) {
+    if (getaddrinfo(name, NULL, hints, res)) {
       log_err(LD_BUG,"(Sandbox) getaddrinfo failed!");
       return -1;
     }

+ 1 - 1
src/common/sandbox.h

@@ -133,7 +133,7 @@ typedef struct {
 int sandbox_add_addrinfo(const char *addr);
 
 /** Replacement for getaddrinfo(), using pre-recorded results. */
-int sandbox_getaddrinfo(const char *name, struct addrinfo hints,
+int sandbox_getaddrinfo(const char *name, const struct addrinfo *hints,
     struct addrinfo **res);
 
 /** Use <b>fd</b> to log non-survivable sandbox violations. */