From 4b3001a08c84edfb1e5c7f739fc3dafca032a9f7 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Tue, 28 Sep 2004 22:38:21 +0000 Subject: fix some local buffer overflows fix a memory leak svn:r2391 --- src/or/dirserv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/or/dirserv.c') diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 6dddfe6153..55c2b9835b 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -677,7 +677,7 @@ void dirserv_set_cached_directory(const char *directory, time_t when) } cached_directory_published = when; if(get_data_directory(&options)) { - sprintf(filename,"%s/cached-directory", get_data_directory(&options)); + snprintf(filename,sizeof(filename),"%s/cached-directory", get_data_directory(&options)); if(write_str_to_file(filename,cached_directory,0) < 0) { log_fn(LOG_WARN, "Couldn't write cached directory to disk. Ignoring."); } @@ -751,7 +751,7 @@ static int dirserv_regenerate_directory(void) } free(new_directory); if(get_data_directory(&options)) { - sprintf(filename,"%s/cached-directory", get_data_directory(&options)); + snprintf(filename,sizeof(filename),"%s/cached-directory", get_data_directory(&options)); if(write_str_to_file(filename,the_directory,0) < 0) { log_fn(LOG_WARN, "Couldn't write cached directory to disk. Ignoring."); } -- cgit v1.2.3-54-g00ecf