Browse code

core: check if the tcp clone rcv buffer is set when applying changes

(cherry picked from commit aa13720e5d78dde5ae5235c13399848cb8f5a0cc)

Daniel-Constantin Mierla authored on 26/11/2020 12:54:42 • Henning Westerholt committed on 21/12/2020 15:16:16
Showing 3 changed files
... ...
@@ -3220,7 +3220,12 @@ int sip_msg_update_buffer(sip_msg_t *msg, str *obuf)
3220 3220
 		LM_ERR("invalid buffer parameter\n");
3221 3221
 		return -1;
3222 3222
 	}
3223
-
3223
+#ifdef USE_TCP
3224
+	if(tcp_get_clone_rcvbuf()==0) {
3225
+		LM_ERR("tcp clone received buffer not enabled\n");
3226
+		return -1;
3227
+	}
3228
+#endif
3224 3229
 	if(obuf->len >= BUF_SIZE) {
3225 3230
 		LM_ERR("new buffer is too large (%d)\n", obuf->len);
3226 3231
 		return -1;
... ...
@@ -157,6 +157,7 @@ void tcp_options_get(struct cfg_group_tcp* t);
157 157
 
158 158
 #ifdef USE_TCP
159 159
 int tcp_set_clone_rcvbuf(int v);
160
+int tcp_get_clone_rcvbuf(void);
160 161
 #endif /* USE_TCP */
161 162
 
162 163
 #endif /* tcp_options_h */
... ...
@@ -109,6 +109,11 @@ int tcp_set_clone_rcvbuf(int v)
109 109
 	return r;
110 110
 }
111 111
 
112
+int tcp_get_clone_rcvbuf(void)
113
+{
114
+	return tcp_clone_rcvbuf;
115
+}
116
+
112 117
 #ifdef READ_HTTP11
113 118
 static inline char *strfindcasestrz(str *haystack, char *needlez)
114 119
 {