[or-cvs] change INET_NTOA_BUF_LEN+1 to INET_NTOA_BUF_LEN

Peter Palfrader weasel at seul.org
Tue Mar 14 23:40:39 UTC 2006


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv17060/src/or

Modified Files:
	circuitbuild.c connection_edge.c dirserv.c rendcommon.c 
	router.c routerlist.c 
Log Message:
change INET_NTOA_BUF_LEN+1 to INET_NTOA_BUF_LEN
add a comment in a few places where we add weird numbers to buffer lengths


Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.220
retrieving revision 1.221
diff -u -p -d -r1.220 -r1.221
--- circuitbuild.c	10 Mar 2006 16:51:26 -0000	1.220
+++ circuitbuild.c	14 Mar 2006 23:40:37 -0000	1.221
@@ -338,7 +338,7 @@ circuit_handle_first_hop(circuit_t *circ
 {
   crypt_path_t *firsthop;
   connection_t *n_conn;
-  char tmpbuf[INET_NTOA_BUF_LEN+1];
+  char tmpbuf[INET_NTOA_BUF_LEN];
   struct in_addr in;
 
   firsthop = onion_next_hop_in_cpath(circ->cpath);

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.383
retrieving revision 1.384
diff -u -p -d -r1.383 -r1.384
--- connection_edge.c	12 Mar 2006 05:04:16 -0000	1.383
+++ connection_edge.c	14 Mar 2006 23:40:37 -0000	1.384
@@ -718,9 +718,9 @@ client_dns_set_addressmap(const char *ad
                           int ttl)
 {
   struct in_addr in;
-  char extendedaddress[MAX_SOCKS_ADDR_LEN+MAX_HEX_NICKNAME_LEN+10];
+  char extendedaddress[MAX_SOCKS_ADDR_LEN+MAX_HEX_NICKNAME_LEN+10]; /* <address>.<hex or nickname>.exit\0  or just  <address>\0 */
   char valbuf[INET_NTOA_BUF_LEN];
-  char extendedval[INET_NTOA_BUF_LEN+MAX_HEX_NICKNAME_LEN+10];
+  char extendedval[INET_NTOA_BUF_LEN+MAX_HEX_NICKNAME_LEN+10]; /* 123.123.123.123.<hex or nickname>.exit\0   or just  123.123.123.123\0 */
 
   tor_assert(address); tor_assert(val);
 

Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.305
retrieving revision 1.306
diff -u -p -d -r1.305 -r1.306
--- dirserv.c	14 Mar 2006 22:43:52 -0000	1.305
+++ dirserv.c	14 Mar 2006 23:40:37 -0000	1.306
@@ -1310,7 +1310,7 @@ generate_v2_networkstatus(void)
   char *outp, *endp;
   or_options_t *options = get_options();
   char fingerprint[FINGERPRINT_LEN+1];
-  char ipaddr[INET_NTOA_BUF_LEN+1];
+  char ipaddr[INET_NTOA_BUF_LEN];
   char published[ISO_TIME_LEN+1];
   char digest[DIGEST_LEN];
   struct in_addr in;

Index: rendcommon.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/rendcommon.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -p -d -r1.68 -r1.69
--- rendcommon.c	12 Mar 2006 23:31:16 -0000	1.68
+++ rendcommon.c	14 Mar 2006 23:40:37 -0000	1.69
@@ -314,7 +314,7 @@ rend_valid_service_id(const char *query)
 int
 rend_cache_lookup_entry(const char *query, int version, rend_cache_entry_t **e)
 {
-  char key[REND_SERVICE_ID_LEN+2];
+  char key[REND_SERVICE_ID_LEN+2]; /* 1<query>\0   or  0<query>\0 */
   tor_assert(rend_cache);
   if (!rend_valid_service_id(query))
     return -1;
@@ -366,7 +366,7 @@ rend_cache_store(const char *desc, size_
   rend_cache_entry_t *e;
   rend_service_descriptor_t *parsed;
   char query[REND_SERVICE_ID_LEN+1];
-  char key[REND_SERVICE_ID_LEN+2];
+  char key[REND_SERVICE_ID_LEN+2]; /* 1<query>\0   or  0<query>\0 */
   time_t now;
 
   tor_assert(rend_cache);

Index: router.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/router.c,v
retrieving revision 1.251
retrieving revision 1.252
diff -u -p -d -r1.251 -r1.252
--- router.c	12 Mar 2006 22:48:18 -0000	1.251
+++ router.c	14 Mar 2006 23:40:37 -0000	1.252
@@ -244,8 +244,7 @@ init_keys(void)
   char keydir[512];
   char keydir2[512];
   char fingerprint[FINGERPRINT_LEN+1];
-  /*nickname fp\n\0 */
-  char fingerprint_line[FINGERPRINT_LEN+MAX_NICKNAME_LEN+3];
+  char fingerprint_line[MAX_NICKNAME_LEN+FINGERPRINT_LEN+3]; /*nickname<space>fp\n\0 */
   char *cp;
   const char *mydesc, *datadir;
   crypto_pk_env_t *prkey;

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.454
retrieving revision 1.455
diff -u -p -d -r1.454 -r1.455
--- routerlist.c	12 Mar 2006 23:31:16 -0000	1.454
+++ routerlist.c	14 Mar 2006 23:40:37 -0000	1.455
@@ -2252,7 +2252,7 @@ update_networkstatus_cache_downloads(tim
     /* An authority launches a separate connection for everybody. */
     SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, ds,
        {
-         char resource[HEX_DIGEST_LEN+6];
+         char resource[HEX_DIGEST_LEN+6]; /* fp/hexdigit.z\0 */
          if (router_digest_is_me(ds->digest))
            continue;
          if (connection_get_by_type_addr_port_purpose(



More information about the tor-commits mailing list