summaryrefslogtreecommitdiff
path: root/src/common/buffers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-09-12 21:09:18 -0400
committerNick Mathewson <nickm@torproject.org>2017-09-12 21:32:42 -0400
commit4ff170d7b1cbe4074cb85271b82a8963eccc8286 (patch)
tree459640c64a49ee1342338647cd67570cac605516 /src/common/buffers.c
parent491b6de1684e519d1fec870a5b46a4bb540cbc13 (diff)
downloadtor-4ff170d7b1cbe4074cb85271b82a8963eccc8286.tar.gz
tor-4ff170d7b1cbe4074cb85271b82a8963eccc8286.zip
Fix warnings about passing uninitialized buffers into functions
Most of these buffers were never actually inspected, but it's still bad style.
Diffstat (limited to 'src/common/buffers.c')
-rw-r--r--src/common/buffers.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/buffers.c b/src/common/buffers.c
index 50673646df..9583c70361 100644
--- a/src/common/buffers.c
+++ b/src/common/buffers.c
@@ -907,6 +907,8 @@ buf_peek_startswith(const buf_t *buf, const char *cmd)
{
char tmp[PEEK_BUF_STARTSWITH_MAX];
size_t clen = strlen(cmd);
+ if (clen == 0)
+ return 1;
if (BUG(clen > sizeof(tmp)))
return 0;
if (buf->datalen < clen)