[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[or-cvs] bugfix: create_onion now works with routelen>2



Update of /home/or/cvsroot/src/or
In directory moria.seul.org:/home/arma/work/onion/cvs/src/or

Modified Files:
	onion.c 
Log Message:
bugfix: create_onion now works with routelen>2


Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- onion.c	18 Jul 2002 23:44:57 -0000	1.4
+++ onion.c	20 Jul 2002 01:59:28 -0000	1.5
@@ -159,8 +159,8 @@
   unsigned char *bufp;
   routerinfo_t *router;
 
-  if ( (rarray) && (route) && (lenp) ) /* valid parameters */
-  {
+  assert(rarray && route && lenp && routelen);
+
     /* calculate the size of the onion */
     *lenp = routelen * 28 + 100; /* 28 bytes per layer + 100 bytes padding for the innermost layer */
     log(LOG_DEBUG,"create_onion() : Size of the onion is %u.",*lenp);
@@ -337,13 +337,10 @@
       log(LOG_DEBUG,"create_onion() : Encrypted layer.");
       
       /* calculate pointer to next layer */
-      layer = (onion_layer_t *)bufp + (routelen-i-2)*sizeof(onion_layer_t);
+      layer = (onion_layer_t *)(bufp + (routelen-i-2)*sizeof(onion_layer_t));
     }
 
     return bufp;
-  } /* valid parameters */
-  else
-    return NULL;
 }
 
 /* encrypts 128 bytes of the onion with the specified public key, the rest with