Thread (9 messages) 9 messages, 3 authors, 2012-11-20

Re: [PATCH 2/3] sdp: Limit side effects of sdp_get_data_type and sdp_get_data_size

From: Anderson Lizardo <hidden>
Date: 2012-11-19 20:24:04

Hi Bart,

On Mon, Nov 19, 2012 at 3:04 PM, Bart Westgeest [off-list ref] wrote:
quoted hunk ↗ jump to hunk
@@ -762,9 +757,6 @@ static int sdp_get_data_size(sdp_buf_t *buf, sdp_data_t *d)
                break;
        }

-       if (!buf->data)
-               buf->buf_size += data_size;
-
        return data_size;
 }
@@ -783,8 +775,8 @@ static int sdp_gen_buffer(sdp_buf_t *buf, sdp_data_t *d)
        /* attribute length */
        buf->buf_size += sizeof(uint8_t) + sizeof(uint16_t);

-       sdp_get_data_type(buf, d->dtd);
-       sdp_get_data_size(buf, d);
+       buf->buf_size += sdp_get_data_type_size(d->dtd);
+       buf->buf_size += sdp_get_data_size(buf, d);
No need to check for "if (!buf->data)" like in the original code?
quoted hunk ↗ jump to hunk
        if (buf->buf_size > UCHAR_MAX && d->dtd == SDP_SEQ8)
                buf->buf_size += sizeof(uint8_t);
@@ -803,7 +795,7 @@ int sdp_gen_pdu(sdp_buf_t *buf, sdp_data_t *d)
        uint128_t u128;
        uint8_t *seqp = buf->data + buf->data_size;

-       pdu_size = sdp_get_data_type(buf, dtd);
+       pdu_size = sdp_get_data_type_size(dtd);
Same here. Additionally, buf->buf_size is not being updated.
        buf->data_size += pdu_size;

        data_size = sdp_get_data_size(buf, d);
Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help