Skip to content

Commit

Permalink
core: check if the tcp clone rcv buffer is set when applying changes
Browse files Browse the repository at this point in the history
(cherry picked from commit aa13720)
  • Loading branch information
miconda committed Dec 11, 2020
1 parent 5c6ddfe commit 7c7fc27
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/msg_translator.c
Expand Up @@ -3251,7 +3251,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;
Expand Down
1 change: 1 addition & 0 deletions src/core/tcp_options.h
Expand Up @@ -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 */
5 changes: 5 additions & 0 deletions src/core/tcp_read.c
Expand Up @@ -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
static inline char *strfindcasestrz(str *haystack, char *needlez)
{
Expand Down

0 comments on commit 7c7fc27

Please sign in to comment.