diff --git a/core/AmSdp.cpp b/core/AmSdp.cpp index 70d1af05..e3861db3 100644 --- a/core/AmSdp.cpp +++ b/core/AmSdp.cpp @@ -34,6 +34,7 @@ #include "AmCmd.h" #include "AmUtils.h" #include "AmPlugIn.h" +#include "AmSession.h" #include "amci/amci.h" #include "log.h" @@ -139,7 +140,10 @@ AmSdp::AmSdp(const AmSdp& p_sdp_msg) void AmSdp::setBody(const char* _sdp_msg) { - strcpy(r_buf,_sdp_msg); + if (!memchr(_sdp_msg, '\0', BUFFER_SIZE)) { + throw AmSession::Exception(513, "Message too big"); + } + strcpy(r_buf, _sdp_msg); } diff --git a/core/AmSdp.h b/core/AmSdp.h index 5f5c63e8..5d4ac557 100644 --- a/core/AmSdp.h +++ b/core/AmSdp.h @@ -44,7 +44,7 @@ using std::vector; */ /** Scratch buffer size. */ -#define BUFFER_SIZE 1024 +#define BUFFER_SIZE 2048 /** network type */ enum NetworkType { NT_OTHER=0, NT_IN };