[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Thats the letter I and the number 2. (Apologies to Negativl...



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

Modified Files:
	main.c test.c 
Log Message:
Thats the letter I and the number 2. (Apologies to Negativland)

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- main.c	8 May 2003 21:35:11 -0000	1.59
+++ main.c	9 May 2003 01:04:58 -0000	1.60
@@ -696,11 +696,12 @@
 dump_signed_directory_to_string_impl(char *s, int maxlen, directory_t *dir,
                                      crypto_pk_env_t *private_key)
 {
-  char *cp;
+  char *cp, *eos;
   char digest[20];
   char signature[128];
   int i, written;
   routerinfo_t *router;
+  eos = s+maxlen;
   strncpy(s, 
           "signed-directory\n"
           "client-software x y z\n" /* XXX make this real */
@@ -711,14 +712,13 @@
   cp = s+i;
   for (i = 0; i < dir->n_routers; ++i) {
     router = dir->routers[i];
-    written = dump_router_to_string(cp, maxlen-i, router);
+    written = dump_router_to_string(cp, eos-cp, router);
 
     if(written < 0) { 
       log(LOG_ERR,"dump_signed_directory_to_string(): tried to exceed string length.");
       cp[maxlen-1] = 0; /* make sure it's null terminated */
       return -1;
     }
-    i += written;
     cp += written;
   }
 

Index: test.c
===================================================================
RCS file: /home/or/cvsroot/src/or/test.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- test.c	7 May 2003 18:30:46 -0000	1.16
+++ test.c	9 May 2003 01:04:58 -0000	1.17
@@ -634,6 +634,8 @@
   /* puts(buf); */
   
   test_assert(! router_get_dir_from_string_impl(buf, &dir2, pk1));
+  test_eq(2, dir2->n_routers);
+  
 
   if (pk1_str) free(pk1_str);
   if (pk2_str) free(pk2_str);