diff options
| author | Vinicius Costa Gomes <vinicius.gomes@openbossa.org> | 2008-09-10 19:32:41 -0300 | 
|---|---|---|
| committer | Vinicius Costa Gomes <vinicius.gomes@openbossa.org> | 2008-09-10 19:32:41 -0300 | 
| commit | 0477cf9b6c61ab1f329206f8b40bcf8e8bfbaad5 (patch) | |
| tree | 801b034996547c4d94cb3209777091f4bd13884f | |
| parent | 46218dfbc599b60aacaf2807cefdbddff3aee453 (diff) | |
Increases the size of the sdp pdu buffer and adds a sanity check for it
| -rw-r--r-- | lib/sdp.c | 10 | 
1 files changed, 5 insertions, 5 deletions
| @@ -816,11 +816,11 @@ int sdp_gen_pdu(sdp_buf_t *buf, sdp_data_t *d)  	}  	if (!is_seq && !is_alt) { -		if (src && buf) { +		if (src && buf && buf->buf_size >= buf->data_size + data_size) {  			memcpy(buf->data + buf->data_size, src, data_size);  			buf->data_size += data_size;  		} else if (dtd != SDP_DATA_NIL) -			SDPDBG("Gen PDU : Cant copy from NULL source or dest\n"); +			SDPDBG("Gen PDU : Can't copy from invalid source or dest\n");  	}  	pdu_size += data_size; @@ -2551,7 +2551,7 @@ void sdp_append_to_buf(sdp_buf_t *dst, uint8_t *data, uint32_t len)  void sdp_append_to_pdu(sdp_buf_t *pdu, sdp_data_t *d)  { -	uint8_t buf[256]; +	uint8_t buf[512];  	sdp_buf_t append;  	memset(&append, 0, sizeof(sdp_buf_t)); @@ -2957,8 +2957,8 @@ static int gen_dataseq_pdu(uint8_t *dst, const sdp_list_t *seq, uint8_t dtd)  	SDPDBG("");  	memset(&buf, 0, sizeof(sdp_buf_t)); -	buf.data = malloc(256); -	buf.buf_size = 256; +	buf.data = malloc(512); +	buf.buf_size = 512;  	if (!buf.data)  		return -ENOMEM; | 
