summaryrefslogtreecommitdiff
path: root/src/common/util.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-01-26 18:01:06 -0500
committerNick Mathewson <nickm@torproject.org>2013-01-26 18:01:06 -0500
commitacd72d4e3e47c2d81d9f3586d227069b9c87094e (patch)
tree67671109ff5e30cb0f539ab28ae6e9e5e07cc7f4 /src/common/util.h
parentdfbd19df418347d833df650e68367c96a3aa37ad (diff)
downloadtor-acd72d4e3e47c2d81d9f3586d227069b9c87094e.tar.gz
tor-acd72d4e3e47c2d81d9f3586d227069b9c87094e.zip
Correctly copy microdescs/extrinfos with internal NUL bytes
Fixes bug 8037; bugfix on 0.2.0.1-alpha; reported by cypherpunks.
Diffstat (limited to 'src/common/util.h')
-rw-r--r--src/common/util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/util.h b/src/common/util.h
index 59c43a4441..170fb232f8 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -83,6 +83,8 @@ char *tor_strndup_(const char *s, size_t n DMALLOC_PARAMS)
ATTR_MALLOC ATTR_NONNULL((1));
void *tor_memdup_(const void *mem, size_t len DMALLOC_PARAMS)
ATTR_MALLOC ATTR_NONNULL((1));
+void *tor_memdup_nulterm_(const void *mem, size_t len DMALLOC_PARAMS)
+ ATTR_MALLOC ATTR_NONNULL((1));
void tor_free_(void *mem);
#ifdef USE_DMALLOC
extern int dmalloc_free(const char *file, const int line, void *pnt,
@@ -117,6 +119,7 @@ extern int dmalloc_free(const char *file, const int line, void *pnt,
#define tor_strdup(s) tor_strdup_(s DMALLOC_ARGS)
#define tor_strndup(s, n) tor_strndup_(s, n DMALLOC_ARGS)
#define tor_memdup(s, n) tor_memdup_(s, n DMALLOC_ARGS)
+#define tor_memdup_nulterm(s, n) tor_memdup_nulterm_(s, n DMALLOC_ARGS)
void tor_log_mallinfo(int severity);