[tor-commits] [torsocks/master] Fix: check is_suid flag before each getenv()
dgoulet at torproject.org
dgoulet at torproject.org
Fri Apr 4 22:40:27 UTC 2014
commit b5adeb2da07a3135a989e5e59d003d4c2591c49e
Author: David Goulet <dgoulet at ev0ke.net>
Date: Thu Feb 20 12:20:57 2014 +0000
Fix: check is_suid flag before each getenv()
Reported-by: Nick Mathewson <nickm at torproject.org>
Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
src/lib/torsocks.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/lib/torsocks.c b/src/lib/torsocks.c
index 654f825..bb7773c 100644
--- a/src/lib/torsocks.c
+++ b/src/lib/torsocks.c
@@ -168,11 +168,13 @@ error:
static void init_logging(void)
{
int level;
- const char *filepath = NULL, *level_str, *time_status_str;
+ const char *filepath = NULL, *level_str = NULL, *time_status_str = NULL;
enum log_time_status t_status;
/* Get log level from user or use default. */
- level_str = getenv(DEFAULT_LOG_LEVEL_ENV);
+ if (!is_suid) {
+ level_str = getenv(DEFAULT_LOG_LEVEL_ENV);
+ }
if (level_str) {
level = atoi(level_str);
} else {
@@ -181,7 +183,9 @@ static void init_logging(void)
}
/* Get time status from user or use default. */
- time_status_str = getenv(DEFAULT_LOG_TIME_ENV);
+ if (!is_suid) {
+ time_status_str = getenv(DEFAULT_LOG_TIME_ENV);
+ }
if (time_status_str) {
t_status = atoi(time_status_str);
} else {
More information about the tor-commits
mailing list