[tor-commits] [tor/master] Clean up keys on stack in rend_parse_service_authorization()

nickm at torproject.org nickm at torproject.org
Mon Jun 25 16:08:58 UTC 2012


commit b5280efc179bd5ed5607246a3b4460fb7f7c0068
Author: Andrea Shepard <andrea at persephoneslair.org>
Date:   Fri Jun 15 21:47:06 2012 -0700

    Clean up keys on stack in rend_parse_service_authorization()
---
 src/or/rendclient.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 7208fb8..c74be52 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -1198,11 +1198,11 @@ rend_parse_service_authorization(const or_options_t *options,
   strmap_t *parsed = strmap_new();
   smartlist_t *sl = smartlist_new();
   rend_service_authorization_t *auth = NULL;
+  char descriptor_cookie_tmp[REND_DESC_COOKIE_LEN+2];
+  char descriptor_cookie_base64ext[REND_DESC_COOKIE_LEN_BASE64+2+1];
 
   for (line = options->HidServAuth; line; line = line->next) {
     char *onion_address, *descriptor_cookie;
-    char descriptor_cookie_tmp[REND_DESC_COOKIE_LEN+2];
-    char descriptor_cookie_base64ext[REND_DESC_COOKIE_LEN_BASE64+2+1];
     int auth_type_val = 0;
     auth = NULL;
     SMARTLIST_FOREACH(sl, char *, c, tor_free(c););
@@ -1279,6 +1279,8 @@ rend_parse_service_authorization(const or_options_t *options,
   } else {
     strmap_free(parsed, rend_service_authorization_strmap_item_free);
   }
+  memset(descriptor_cookie_tmp, 0, sizeof(descriptor_cookie_tmp));
+  memset(descriptor_cookie_base64ext, 0, sizeof(descriptor_cookie_base64ext));
   return res;
 }
 





More information about the tor-commits mailing list