mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-12-19 17:03:26 +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;
|
struct rtp_header *rtp = (void *) buf;
|
||||||
static bool decode = false;
|
static bool decode = false;
|
||||||
uint16_t imtu;
|
uint16_t imtu;
|
||||||
int fd;
|
int fd, ret;
|
||||||
|
|
||||||
if (!avdtp_stream_get_transport(avdtp_stream, &fd, &imtu, NULL, NULL))
|
if (!avdtp_stream_get_transport(avdtp_stream, &fd, &imtu, NULL, NULL))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (read(fd, buf, imtu) < 0) {
|
ret = read(fd, buf, imtu);
|
||||||
|
if (ret < 0) {
|
||||||
printf("Reading failed (%s)\n", strerror(errno));
|
printf("Reading failed (%s)\n", strerror(errno));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ret < (int) sizeof(*rtp)) {
|
||||||
|
printf("Not enough media data received (%u bytes)", ret);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!decode) {
|
if (!decode) {
|
||||||
printf("V=%u P=%u X=%u CC=%u M=%u PT=%u SeqNr=%d\n",
|
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,
|
rtp->v, rtp->p, rtp->x, rtp->cc, rtp->m, rtp->pt,
|
||||||
|
Loading…
Reference in New Issue
Block a user