aboutsummaryrefslogtreecommitdiff
path: root/src/feature/control/control_cmd.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-04-01 17:29:46 -0400
committerNick Mathewson <nickm@torproject.org>2019-04-12 08:33:27 -0400
commitf3bd0240a6089910f3075a779b32e7aed07338e0 (patch)
tree6d424a70604c4d07cc2fbcfde7e39de26d335dcd /src/feature/control/control_cmd.c
parentd1f5957c4ea82d1622233c0dabd1e761df5200d4 (diff)
downloadtor-f3bd0240a6089910f3075a779b32e7aed07338e0.tar.gz
tor-f3bd0240a6089910f3075a779b32e7aed07338e0.zip
Add assertions for correct input to handle_control_command.
Diffstat (limited to 'src/feature/control/control_cmd.c')
-rw-r--r--src/feature/control/control_cmd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/feature/control/control_cmd.c b/src/feature/control/control_cmd.c
index 4fcfa73105..56202a7ef4 100644
--- a/src/feature/control/control_cmd.c
+++ b/src/feature/control/control_cmd.c
@@ -2398,6 +2398,10 @@ handle_control_command(control_connection_t *conn,
uint32_t cmd_data_len,
char *args)
{
+ tor_assert(conn);
+ tor_assert(args);
+ tor_assert(args[cmd_data_len] == '\0');
+
for (unsigned i = 0; i < N_CONTROL_COMMANDS; ++i) {
const control_cmd_def_t *def = &CONTROL_COMMANDS[i];
if (!strcasecmp(conn->incoming_cmd, def->name)) {