diff options
author | George Kadianakis <desnacked@riseup.net> | 2013-06-12 16:23:16 +0300 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-07-18 08:45:02 -0400 |
commit | ea72958f25f6326d6947c8cd4ef185912582d436 (patch) | |
tree | 8e5913b7f68caca5e184b1a8e737eb1bea2212de /src/common | |
parent | 6cfc2b5d73f6ec1b2ab4af1f209b6126a7d8cba9 (diff) | |
download | tor-ea72958f25f6326d6947c8cd4ef185912582d436.tar.gz tor-ea72958f25f6326d6947c8cd4ef185912582d436.zip |
Pass characters to be escaped to tor_escape_str_for_socks_arg().
This is in preparation for using tor_escape_str_for_socks_arg() to
escape server-side pluggable transport parameters.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/util.c | 10 | ||||
-rw-r--r-- | src/common/util.h | 3 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/common/util.c b/src/common/util.c index d9913dda45..bd38a62800 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1223,17 +1223,15 @@ escaped(const char *s) return escaped_val_; } -/** Escape every ";" or "\" character of <b>string</b>. Use - * <b>escape_char</b> as the character to use for escaping. - * The returned string is allocated on the heap and it's the - * responsibility of the caller to free it. */ +/** Escape every character of <b>string</b> that is in + * <b>chars_to_escape</b>. The returned string is allocated on the + * heap and it's the responsibility of the caller to free it. */ char * -tor_escape_str_for_socks_arg(const char *string) +tor_escape_str_for_socks_arg(const char *string, const char *chars_to_escape) { char *new_string = NULL; char *new_cp = NULL; size_t length, new_length; - static const char *chars_to_escape = ";\\"; tor_assert(string); diff --git a/src/common/util.h b/src/common/util.h index ad75266587..ba0ec98685 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -231,7 +231,8 @@ int tor_digest256_is_zero(const char *digest); char *esc_for_log(const char *string) ATTR_MALLOC; const char *escaped(const char *string); -char *tor_escape_str_for_socks_arg(const char *string); +char *tor_escape_str_for_socks_arg(const char *string, + const char *chars_to_escape); struct smartlist_t; int tor_vsscanf(const char *buf, const char *pattern, va_list ap) \ |