From a2f18ae0234bc6dbccaebd21bc7ea07ceac2ee7a Mon Sep 17 00:00:00 2001 From: Jesper Jensen Date: Mon, 14 Apr 2025 13:06:26 +0200 Subject: Don't crash on invalid dictionary --- src/proto.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/proto.c') diff --git a/src/proto.c b/src/proto.c index 4ea9b20..d4f8b59 100644 --- a/src/proto.c +++ b/src/proto.c @@ -368,7 +368,8 @@ PROCESS_REPONSE(getclient_response) { bcur_next(&bcursor, 1); break; case -BENC_EBADP: - fatal("Bad dict"); + err("Bad Dictionary, Discard packet"); + return PROTO_EDISC; } } @@ -763,7 +764,9 @@ int proto_run(struct dht* dht, char* buff, size_t recv_len, struct sockaddr_in* break; } case -BENC_EBADP: - fatal("Bad dict"); + err("Bad Dictionary, we drop this packet"); + recalulate_waketime(dht); + return 0; } } -- cgit v1.2.3