Browse Source

oaep uses 42 more bytes -- stop clobbering buffers

also maybe fix some constants here and there -- nick?


svn:r1484
Roger Dingledine 21 years ago
parent
commit
27126e5007
4 changed files with 7 additions and 6 deletions
  1. 3 3
      src/or/connection_edge.c
  2. 2 2
      src/or/rendclient.c
  3. 1 1
      src/or/rendmid.c
  4. 1 0
      src/or/rendservice.c

+ 3 - 3
src/or/connection_edge.c

@@ -757,9 +757,6 @@ circuit_get_open_circ_or_launch(connection_t *conn,
     return 1; /* we're happy */
   }
 
-  log_fn(LOG_INFO,"No safe circuit (purpose %d) ready for edge connection; delaying.",
-         desired_circuit_purpose);
-
   if(!*conn->rend_query) { /* general purpose circ */
     addr = client_dns_lookup_entry(conn->socks_request->address);
     if(router_exit_policy_all_routers_reject(addr, conn->socks_request->port)) {
@@ -804,6 +801,9 @@ circuit_get_open_circ_or_launch(connection_t *conn,
       strcpy(circ->rend_query, conn->rend_query);
     }
   }
+  if(!circ)
+    log_fn(LOG_INFO,"No safe circuit (purpose %d) ready for edge connection; delaying.",
+           desired_circuit_purpose);
   *circp = circ;
   return 0;
 }

+ 2 - 2
src/or/rendclient.c

@@ -41,14 +41,14 @@ rend_client_send_establish_rendezvous(circuit_t *circ)
   return 0;
 }
 
-#define LEN_REND_INTRODUCE1 204
+#define LEN_REND_INTRODUCE1 (20+20+20+16+128+42)
 
 int
 rend_client_send_introduction(circuit_t *introcirc, circuit_t *rendcirc) {
   const char *descp;
   int desc_len;
   char payload[LEN_REND_INTRODUCE1];
-  char tmp[LEN_REND_INTRODUCE1-20-16];
+  char tmp[20+20+128];
   rend_service_descriptor_t *parsed=NULL;
 
   assert(introcirc->purpose == CIRCUIT_PURPOSE_C_INTRODUCING);

+ 1 - 1
src/or/rendmid.c

@@ -124,7 +124,7 @@ rend_mid_introduce(circuit_t *circ, const char *request, int request_len)
     goto err;
   }
 
-  if (request_len < 276) {
+  if (request_len < 246) {
     log_fn(LOG_WARN,
            "Impossibly short INTRODUCE1 cell on circuit %d; dropping.",
            circ->p_circ_id);

+ 1 - 0
src/or/rendservice.c

@@ -326,6 +326,7 @@ rend_service_introduce(circuit_t *circuit, const char *request, int request_len)
     return -1;
   }
 
+  /* XXX NM this is wrong, right? */
   /* min key length plus digest length plus nickname length */
   if (request_len < 148) {
     log_fn(LOG_WARN, "Got a truncated INTRODUCE2 cell on circ %d",