[or-cvs] Expect a 20-byte nul-padded-and-terminated nickname

Nick Mathewson nickm at seul.org
Mon Apr 5 17:28:50 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv9832/src/or

Modified Files:
	rendservice.c 
Log Message:
Expect a 20-byte nul-padded-and-terminated nickname

Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- rendservice.c	5 Apr 2004 17:20:57 -0000	1.21
+++ rendservice.c	5 Apr 2004 17:28:48 -0000	1.22
@@ -326,7 +326,7 @@
     return -1;
   }
 
-  /* min key length plus digest length */
+  /* 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",
            circuit->n_circ_id);
@@ -357,9 +357,9 @@
     log_fn(LOG_WARN, "Couldn't decrypt INTRODUCE2 cell");
     return -1;
   }
-  ptr=memchr(buf,0,len);
+  ptr=memchr(buf,0,MAX_NICKNAME_LEN+1);
   if (!ptr || ptr == buf) {
-    log_fn(LOG_WARN, "Couldn't find a null-terminated nickname in INTRODUCE2 cell");
+    log_fn(LOG_WARN, "Couldn't find a null-padded nickname in INTRODUCE2 cell");
     return -1;
   }
   if (strspn(buf,LEGAL_NICKNAME_CHARACTERS) != ptr-buf) {
@@ -368,8 +368,8 @@
   }
   /* Okay, now we know that the nickname is at the start of the buffer. */
   rp_nickname = buf;
-  ++ptr;
-  len -= (ptr-buf);
+  ptr = buf+(MAX_NICKNAME_LEN+1);
+  len -= (MAX_NICKNAME_LEN+1);
   if (len != 20+128) {
     log_fn(LOG_WARN, "Bad length for INTRODUCE2 cell.");
     return -1;



More information about the tor-commits mailing list