mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-12-18 16:33:30 +08:00
android/avdtptest: Verify data before processing rtp header
This commit is contained in:
parent
4fc3bd0466
commit
2fb65926d4
@ -244,16 +244,22 @@ static gboolean media_reader(GIOChannel *source, GIOCondition condition,
|
||||
struct rtp_header *rtp = (void *) buf;
|
||||
static bool decode = false;
|
||||
uint16_t imtu;
|
||||
int fd;
|
||||
int fd, ret;
|
||||
|
||||
if (!avdtp_stream_get_transport(avdtp_stream, &fd, &imtu, NULL, NULL))
|
||||
return TRUE;
|
||||
|
||||
if (read(fd, buf, imtu) < 0) {
|
||||
ret = read(fd, buf, imtu);
|
||||
if (ret < 0) {
|
||||
printf("Reading failed (%s)\n", strerror(errno));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (ret < (int) sizeof(*rtp)) {
|
||||
printf("Not enough media data received (%u bytes)", ret);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!decode) {
|
||||
printf("V=%u P=%u X=%u CC=%u M=%u PT=%u SeqNr=%d\n",
|
||||
rtp->v, rtp->p, rtp->x, rtp->cc, rtp->m, rtp->pt,
|
||||
|
Loading…
Reference in New Issue
Block a user