Skip to content

Commit dce4b8f

Browse files
author
Stephan Zeisberg
committed
Fix overwriting connection in hashmap
1 parent 8b6489d commit dce4b8f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/rpc/connection/connection.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,15 @@ STATIC void parse_cb(inputstream *istream, void *data, bool eof)
413413
con->cc.state = TUNNEL_INITIAL;
414414
}
415415

416+
if (hashmap_has(cstr_t, uint64_t)(pluginkeys,
417+
con->cc.pluginkeystring)) {
418+
LOG_WARNING("pluginkey already registered, closing connection");
419+
sbmemzero(con->cc.pluginkeystring,
420+
sizeof con->cc.pluginkeystring);
421+
connection_close(con);
422+
goto end;
423+
}
424+
416425
hashmap_put(cstr_t, uint64_t)(pluginkeys, con->cc.pluginkeystring,
417426
con->id);
418427
}

0 commit comments

Comments
 (0)