about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--btpd/net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/btpd/net.c b/btpd/net.c
index fca3143..c728efd 100644
--- a/btpd/net.c
+++ b/btpd/net.c
@@ -235,7 +235,7 @@ net_dispatch_msg(struct peer *p, const char *buf)
             length = net_read32(buf + 8);
             if ((length > PIECE_BLOCKLEN
                     || index >= p->n->tp->meta.npieces
-                    || cm_has_piece(p->n->tp, index)
+                    || !cm_has_piece(p->n->tp, index)
                     || begin + length > torrent_piece_size(p->n->tp, index))) {
                 btpd_log(BTPD_L_MSG, "bad request: (%u, %u, %u) from %p\n",
                          index, begin, length, p);