summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-09-06 20:26:20 -0400
committerNick Mathewson <nickm@torproject.org>2011-09-06 20:26:20 -0400
commit2bf0e7479bc9ec26496405ff6a1ef830cacc001b (patch)
tree90d64ba5b4d43ef937fcf55b612fc9dca5a0f96f
parente0dae64449958f4c80e6da1ee6a336a60ffc21d5 (diff)
downloadtor-2bf0e7479bc9ec26496405ff6a1ef830cacc001b.tar.gz
tor-2bf0e7479bc9ec26496405ff6a1ef830cacc001b.zip
Fix assertion in addressmap_clear_excluded_trackexithosts
Fixes bug 3923; bugfix on 0.2.2.25-alpha; bugfix from 'laruldan' on trac.
-rw-r--r--changes/bug39235
-rw-r--r--src/or/connection_edge.c10
2 files changed, 9 insertions, 6 deletions
diff --git a/changes/bug3923 b/changes/bug3923
new file mode 100644
index 0000000000..9c0e138826
--- /dev/null
+++ b/changes/bug3923
@@ -0,0 +1,5 @@
+ o Major bugfies:
+ - Avoid an assertion failure when reloading a configuration with
+ TrackExitHosts changes. Found and fixed by 'laruldan'. Fixes
+ bug 3923; bugfix on 0.2.2.25-alpha.
+
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index d4d7e1c73c..8609b023d5 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -842,12 +842,10 @@ addressmap_clear_excluded_trackexithosts(or_options_t *options)
if (len < 6)
continue; /* malformed. */
dot = target + len - 6; /* dot now points to just before .exit */
- dot = strrchr(dot, '.'); /* dot now points to the . before .exit or NULL */
- if (!dot) {
- nodename = tor_strndup(target, len-5);
- } else {
- nodename = tor_strndup(dot+1, strlen(dot+1)-5);
- }
+ while(dot > target && *dot != '.')
+ dot--;
+ if (*dot == '.') dot++;
+ nodename = tor_strndup(dot, len-5-(dot-target));;
ri = router_get_by_nickname(nodename, 0);
tor_free(nodename);
if (!ri ||
lor: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/* Copyright (c) 2003-2004, Roger Dingledine
 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */

/**
 * \file process_win32.h
 * \brief Header for process_win32.c
 **/

#ifndef TOR_PROCESS_WIN32_H
#define TOR_PROCESS_WIN32_H

#ifdef _WIN32

#include "orconfig.h"
#include "lib/malloc/malloc.h"
#include "lib/evloop/compat_libevent.h"

#include <windows.h>

struct process_t;

struct process_win32_t;
typedef struct process_win32_t process_win32_t;

process_win32_t *process_win32_new(void);
void process_win32_free_(process_win32_t *win32_process);
#define process_win32_free(s) \
  FREE_AND_NULL(process_win32_t, process_win32_free_, (s))

void process_win32_init(void);
void process_win32_deinit(void);

process_status_t process_win32_exec(struct process_t *process);
bool process_win32_terminate(struct process_t *process);

process_pid_t process_win32_get_pid(struct process_t *process);

int process_win32_write(struct process_t *process, buf_t *buffer);
int process_win32_read_stdout(struct process_t *process, buf_t *buffer);
int process_win32_read_stderr(struct process_t *process, buf_t *buffer);

void process_win32_trigger_completion_callbacks(void);

/* Timer handling. */
void process_win32_timer_start(void);
void process_win32_timer_stop(void);
bool process_win32_timer_running(void);

#ifdef PROCESS_WIN32_PRIVATE
STATIC void process_win32_timer_callback(periodic_timer_t *, void *);
STATIC bool process_win32_timer_test_process(process_t *);

/* I/O pipe handling. */
struct process_win32_handle_t;
typedef struct process_win32_handle_t process_win32_handle_t;

typedef enum process_win32_pipe_type_t {
  /** This pipe is used for reading. */
  PROCESS_WIN32_PIPE_TYPE_READER,

  /** This pipe is used for writing. */
  PROCESS_WIN32_PIPE_TYPE_WRITER
} process_win32_pipe_type_t;

STATIC bool process_win32_create_pipe(HANDLE *,
                                      HANDLE *,
                                      SECURITY_ATTRIBUTES *,
                                      process_win32_pipe_type_t);

STATIC void process_win32_cleanup_handle(process_win32_handle_t *handle);

STATIC VOID WINAPI process_win32_stdout_read_done(DWORD,
                                                  DWORD,
                                                  LPOVERLAPPED);
STATIC VOID WINAPI process_win32_stderr_read_done(DWORD,
                                                  DWORD,
                                                  LPOVERLAPPED);
STATIC VOID WINAPI process_win32_stdin_write_done(DWORD,
                                                  DWORD,
                                                  LPOVERLAPPED);

STATIC int process_win32_read_from_handle(process_win32_handle_t *,
                                          buf_t *,
                                          LPOVERLAPPED_COMPLETION_ROUTINE);
STATIC bool process_win32_handle_read_completion(process_win32_handle_t *,
                                                 DWORD,
                                                 DWORD);

STATIC char *format_win_cmdline_argument(const char *arg);
STATIC char *tor_join_win_cmdline(const char *argv[]);
#endif /* defined(PROCESS_WIN32_PRIVATE). */

#endif /* ! defined(_WIN32). */

#endif /* defined(TOR_PROCESS_WIN32_H). */