dump exit policies correctly to descriptor

svn:r815
This commit is contained in:
Roger Dingledine 2003-11-16 17:15:40 +00:00
parent fe856406be
commit b5e84e24ae

View File

@ -1198,6 +1198,10 @@ static void get_platform_str(char *platform, int len)
return; return;
} }
/* XXX need to audit this thing and count fenceposts. maybe
* refactor so we don't have to keep asking if we're
* near the end of maxlen?
*/
#define DEBUG_ROUTER_DUMP_ROUTER_TO_STRING #define DEBUG_ROUTER_DUMP_ROUTER_TO_STRING
int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router, int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router,
crypto_pk_env_t *ident_key) { crypto_pk_env_t *ident_key) {
@ -1294,11 +1298,15 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router,
return -1; return -1;
written += result; written += result;
} else { } else {
if (written > maxlen-3) if (written > maxlen-4)
return -1; return -1;
strcat(s+written, ":*"); strcat(s+written, ":*");
} }
} if(written > maxlen-1)
return -1;
strcat(s+written, "\n");
written++;
} /* end for */
if (written > maxlen-256) /* Not enough room for signature. */ if (written > maxlen-256) /* Not enough room for signature. */
return -1; return -1;