Diff between 7bf67b32709d828fafa26256b4c78331760c6e93 and 6c7243fb6ab90b7b855cead98c66394fedea135f

Changed Files

File Additions Deletions Status
lib/sdp.c +6 -0 modified

Full Patch

diff --git a/lib/sdp.c b/lib/sdp.c
index eb408a9..84311ed 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -2834,6 +2834,12 @@ void sdp_append_to_buf(sdp_buf_t *dst, uint8_t *data, uint32_t len)
 	SDPDBG("Append src size: %d", len);
 	SDPDBG("Append dst size: %d", dst->data_size);
 	SDPDBG("Dst buffer size: %d", dst->buf_size);
+
+	if (dst->data_size + len > dst->buf_size) {
+		SDPERR("Cannot append");
+		return;
+	}
+
 	if (dst->data_size == 0 && dtd == 0) {
 		/* create initial sequence */
 		*p = SDP_SEQ8;