Module: kamailio
Branch: master
Commit: 2fc11f183d8fcedeb35559c5236ad7159a6a5864
URL:
https://github.com/kamailio/kamailio/commit/2fc11f183d8fcedeb35559c5236ad71…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-09-05T11:48:02+02:00
core: tcp - improved safety check for available byte in tcp read buffer
---
Modified: src/core/tcp_read.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2fc11f183d8fcedeb35559c5236ad71…
Patch:
https://github.com/kamailio/kamailio/commit/2fc11f183d8fcedeb35559c5236ad71…
---
diff --git a/src/core/tcp_read.c b/src/core/tcp_read.c
index 0dc7838df8..6bb52745a4 100644
--- a/src/core/tcp_read.c
+++ b/src/core/tcp_read.c
@@ -356,7 +356,7 @@ int tcp_read(struct tcp_connection *c, int* flags)
fd=c->fd;
bytes_free=r->b_size- (int)(r->pos - r->buf);
- if (unlikely(bytes_free==0)){
+ if (unlikely(bytes_free<=0)){
LM_ERR("buffer overrun, dropping ([%s]:%u -> [%s]:%u)\n",
ip_addr2a(&c->rcv.src_ip), c->rcv.src_port,
ip_addr2a(&c->rcv.dst_ip), c->rcv.dst_port);