Module: kamailio
Branch: master
Commit: aa13720e5d78dde5ae5235c13399848cb8f5a0cc
URL:
https://github.com/kamailio/kamailio/commit/aa13720e5d78dde5ae5235c13399848…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-11-26T13:55:17+01:00
core: check if the tcp clone rcv buffer is set when applying changes
---
Modified: src/core/msg_translator.c
Modified: src/core/tcp_options.h
Modified: src/core/tcp_read.c
---
Diff:
https://github.com/kamailio/kamailio/commit/aa13720e5d78dde5ae5235c13399848…
Patch:
https://github.com/kamailio/kamailio/commit/aa13720e5d78dde5ae5235c13399848…
---
diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c
index 07e70b715f..f895df9683 100644
--- a/src/core/msg_translator.c
+++ b/src/core/msg_translator.c
@@ -3252,7 +3252,12 @@ int sip_msg_update_buffer(sip_msg_t *msg, str *obuf)
LM_ERR("invalid buffer parameter\n");
return -1;
}
-
+#ifdef USE_TCP
+ if(tcp_get_clone_rcvbuf()==0) {
+ LM_ERR("tcp clone received buffer not enabled\n");
+ return -1;
+ }
+#endif
if(obuf->len >= BUF_SIZE) {
LM_ERR("new buffer is too large (%d)\n", obuf->len);
return -1;
diff --git a/src/core/tcp_options.h b/src/core/tcp_options.h
index f9729544df..61d5828c27 100644
--- a/src/core/tcp_options.h
+++ b/src/core/tcp_options.h
@@ -157,6 +157,7 @@ void tcp_options_get(struct cfg_group_tcp* t);
#ifdef USE_TCP
int tcp_set_clone_rcvbuf(int v);
+int tcp_get_clone_rcvbuf(void);
#endif /* USE_TCP */
#endif /* tcp_options_h */
diff --git a/src/core/tcp_read.c b/src/core/tcp_read.c
index 8944d246c1..3ae21a71d9 100644
--- a/src/core/tcp_read.c
+++ b/src/core/tcp_read.c
@@ -109,6 +109,11 @@ int tcp_set_clone_rcvbuf(int v)
return r;
}
+int tcp_get_clone_rcvbuf(void)
+{
+ return tcp_clone_rcvbuf;
+}
+
#ifdef READ_HTTP11
int tcp_http11_continue(struct tcp_connection *c)
{