[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [torsocks/master] Fix: check is_suid flag before each getenv()
commit b5adeb2da07a3135a989e5e59d003d4c2591c49e
Author: David Goulet <dgoulet@xxxxxxxxx>
Date: Thu Feb 20 12:20:57 2014 +0000
Fix: check is_suid flag before each getenv()
Reported-by: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Signed-off-by: David Goulet <dgoulet@xxxxxxxxx>
---
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 {
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits