Browse code

core: tcp - improved safety check for available byte in tcp read buffer

Daniel-Constantin Mierla authored on 05/09/2018 09:48:02
Showing 1 changed files
... ...
@@ -356,7 +356,7 @@ int tcp_read(struct tcp_connection *c, int* flags)
356 356
 	fd=c->fd;
357 357
 	bytes_free=r->b_size- (int)(r->pos - r->buf);
358 358
 	
359
-	if (unlikely(bytes_free==0)){
359
+	if (unlikely(bytes_free<=0)){
360 360
 		LM_ERR("buffer overrun, dropping ([%s]:%u -> [%s]:%u)\n",
361 361
 				ip_addr2a(&c->rcv.src_ip), c->rcv.src_port,
362 362
 				ip_addr2a(&c->rcv.dst_ip), c->rcv.dst_port);