about summary refs log tree commit homepage
path: root/public-inbox-nntpd
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-20 03:36:11 +0000
committerEric Wong <e@80x24.org>2015-09-20 04:21:27 +0000
commitebb1ae89f3b4a52daaf581e727c0dcbe6b7c103e (patch)
treef036f47b1ab3ec6503fcb10bd11f514d746e7a7a /public-inbox-nntpd
parentf033d9bff75455c6c06ce39de8c60816868f1457 (diff)
downloadpublic-inbox-ebb1ae89f3b4a52daaf581e727c0dcbe6b7c103e.tar.gz
We cannot use the push_back_read functionality of Danga::Socket
since it will trigger event_read on buffered data.  This would
allow a malicious (or badly implemented) client to burn CPU
without actually sending us anything.

So we still do buffering ourselves and play some tricks with
timers re-enable readability.
Diffstat (limited to 'public-inbox-nntpd')
-rw-r--r--public-inbox-nntpd3
1 files changed, 2 insertions, 1 deletions
diff --git a/public-inbox-nntpd b/public-inbox-nntpd
index 588efdd3..b66de58e 100644
--- a/public-inbox-nntpd
+++ b/public-inbox-nntpd
@@ -146,7 +146,8 @@ sub worker_quit {
                 my ($dmap, undef) = @_;
                 my $n = 0;
                 foreach my $s (values %$dmap) {
-                        if ($s->{write_buf_size} || @{$s->{read_push_back}}) {
+                        next unless ref($s) eq 'PublicInbox::NNTP';
+                        if ($s->{write_buf_size} || $s->{rbuf}) {
                                 ++$n;
                         } else {
                                 $s->close;