Add notion of "longest nickname-or-hex-digest-with-$"

svn:r2108
This commit is contained in:
Nick Mathewson 2004-07-22 21:31:04 +00:00
parent 0c990259de
commit 7b4865ec33
3 changed files with 4 additions and 2 deletions

View File

@ -699,7 +699,7 @@ static int generate_runningrouters(crypto_pk_env_t *private_key)
char published[33]; char published[33];
time_t published_on; time_t published_on;
len = 1024+MAX_NICKNAME_LEN*smartlist_len(descriptor_list); len = 1024+(MAX_HEX_NICKNAME_LEN+2)*smartlist_len(descriptor_list);
s = tor_malloc_zero(len); s = tor_malloc_zero(len);
if (list_running_servers(&cp)) if (list_running_servers(&cp))
return -1; return -1;

View File

@ -123,6 +123,8 @@
#define DEFAULT_BANDWIDTH_OP (1024 * 1000) #define DEFAULT_BANDWIDTH_OP (1024 * 1000)
#define MAX_NICKNAME_LEN 19 #define MAX_NICKNAME_LEN 19
/* Hex digest plus dollar sign. */
#define MAX_HEX_NICKNAME_LEN HEX_DIGEST_LEN+1
#define MAX_DIR_SIZE 500000 #define MAX_DIR_SIZE 500000
#ifdef TOR_PERF #ifdef TOR_PERF

View File

@ -147,7 +147,7 @@ int all_directory_servers_down(void) {
*/ */
void add_nickname_list_to_smartlist(smartlist_t *sl, const char *list) { void add_nickname_list_to_smartlist(smartlist_t *sl, const char *list) {
const char *start,*end; const char *start,*end;
char nick[MAX_NICKNAME_LEN+1]; char nick[MAX_HEX_NICKNAME_LEN+1];
routerinfo_t *router; routerinfo_t *router;
tor_assert(sl); tor_assert(sl);