diff options
| author | Nakidai <nakidai@disroot.org> | 2026-01-29 19:07:11 +0300 |
|---|---|---|
| committer | Nakidai <nakidai@disroot.org> | 2026-01-29 19:07:11 +0300 |
| commit | 4060d0d0d7ee06ed6dad834dbb12f4381489aec0 (patch) | |
| tree | 280b663511228dfdf439a2b4444ee5fa6c08d1a4 /peer.c | |
| parent | 9436897bfb8b5f72109667d86aed06d9a9d1a693 (diff) | |
| download | libreircd-4060d0d0d7ee06ed6dad834dbb12f4381489aec0.tar.gz libreircd-4060d0d0d7ee06ed6dad834dbb12f4381489aec0.zip | |
Simplify client's buffer overflow
So I decided to kill a link when there's no IRC message within 512 bytes, because doing so removes code and IMO makes it more clear If peer->recvd == sizeof(peer->buf), then buffer size passed into next read(peer->fd) will be 0, therefore its return value will be 0. Though, this means that link is almost dropped if it sent exactly 512 bytes not containing an \r\n: they can get information, but on next send ircd will close the connection. But this state is unachievable with an IRC client: it either sends a message <= 512 bytes containing an \r\n, or, if one or more bytes longer, well that's already > 512 bytes hence link is still ready to be read and will be kicked after the next poll()
Diffstat (limited to 'peer.c')
| -rw-r--r-- | peer.c | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/peer.c b/peer.c index 21dba70..3634834 100644 --- a/peer.c +++ b/peer.c @@ -60,14 +60,5 @@ handle(struct Peer *peer) next: move(peer, p - peer->buf + 2); } - if (peer->recvd == sizeof(peer->buf)) - { - /* - * TODO: maybe somehow be more careful with peer data? - * or drop them? - */ - memset(peer->buf, 0, sizeof(peer->buf)); - peer->recvd = 0; - } return 0; } |