Add extra sanity check for SDP packets in libsdp(3)
Fix yet another endianess bug in sdpd(8)
This commit is contained in:
parent
f97e834b02
commit
0d60ad30ca
@ -167,6 +167,7 @@ sdp_search(void *xss,
|
||||
|
||||
if (xpdu.pdu.pid == SDP_PDU_ERROR_RESPONSE ||
|
||||
xpdu.pdu.tid != ss->tid ||
|
||||
xpdu.pdu.len > len ||
|
||||
xpdu.len > xpdu.pdu.len) {
|
||||
ss->error = EIO;
|
||||
return (-1);
|
||||
|
@ -277,7 +277,7 @@ server_send_service_attribute_response(server_p srv, int32_t fd)
|
||||
|
||||
assert(rsp_end >= rsp);
|
||||
|
||||
bcount = htons(rsp_end - rsp);
|
||||
bcount = rsp_end - rsp;
|
||||
|
||||
if (((sdp_pdu_p)(srv->req))->pid == SDP_PDU_SERVICE_ATTRIBUTE_REQUEST)
|
||||
pdu.pid = SDP_PDU_SERVICE_ATTRIBUTE_RESPONSE;
|
||||
@ -287,6 +287,8 @@ server_send_service_attribute_response(server_p srv, int32_t fd)
|
||||
pdu.tid = ((sdp_pdu_p)(srv->req))->tid;
|
||||
pdu.len = htons(sizeof(bcount) + bcount + 1 + cs[0]);
|
||||
|
||||
bcount = htons(bcount);
|
||||
|
||||
iov[0].iov_base = &pdu;
|
||||
iov[0].iov_len = sizeof(pdu);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user