lib: Fix sdp_seq_alloc_with_length accessing invalid index/memory
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH v2 1/1 lib: Fix sdp_seq_alloc_with_length accessing invalid index/memory
From: Luiz Augusto von Dentz <[email protected]>
The sequence itself is not an index of dtds, values, lengths, thats why SDP_SEQ8 is used directly as dtd, so accessing length[i] is always off by one.
Furthermore the length is not really used by sdp_data_alloc_with_length when the dtd is SDP_SEQ8 which is probably why it doesn't crash.
---
v2: Fix length typo and add more clear description why this is currently not causing a crash.
lib/sdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/sdp.c +1 -1
@@ -535,7 +535,7 @@ sdp_data_t *sdp_seq_alloc_with_length(void **dtds, void **values, int *length, curr = data; } -return sdp_data_alloc_with_length (SDP_SEQ8 , seq, length[i]); +return sdp_data_alloc (SDP_SEQ8 , seq); }sdp_data_t *sdp_seq_alloc (void **dtds,void **values,int len)
Signature · 1 line
1.8.1.4
Johan Hedberg
AppliedHi Luiz,
Quoted 4 lines · Luiz Augusto von Dentz
The sequence itself is not an index of dtds, values, lengths, thats why
SDP_SEQ8is used directly as dtd, so accessing length[i] is always off by one.
Quoted 8 lines
Furthermore the length is not really used by
sdp_data_alloc_with_lengthwhen the dtd isSDP_SEQ8which is probably why it doesn't crash.
---
v2: Fix length typo and add more clear description why this is currently not causing a crash.lib/sdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied. Thanks.
Johan