diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2025-04-14 13:06:26 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2025-04-14 13:06:26 +0200 |
| commit | a2f18ae0234bc6dbccaebd21bc7ea07ceac2ee7a (patch) | |
| tree | 549b76c49039fe57e616f1e17678b68189425dd8 /src/proto.c | |
| parent | fd0f0b52da637714fb4471ea8c06afe9ea709140 (diff) | |
Don't crash on invalid dictionary
Diffstat (limited to 'src/proto.c')
| -rw-r--r-- | src/proto.c | 7 |
1 files changed, 5 insertions, 2 deletions
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; } } |
