mirror of
https://github.com/ericonr/sndio.git
synced 2024-02-18 04:45:21 -06:00
In OSS/FreeBSD sio_setpar(), validate the encoding, ensuring we
never end-up with an unknown one.
This commit is contained in:
parent
a88873c661
commit
a25bc8355a
@ -415,6 +415,16 @@ sio_oss_setpar(struct sio_hdl *sh, struct sio_par *par)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; ; i++) {
|
||||||
|
if (i == sizeof(formats) / sizeof(formats[0])) {
|
||||||
|
DPRINTF("sio_oss_setpar: unknown fmt %d\n", hdl->fmt);
|
||||||
|
hdl->sio.eof = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (formats[i].fmt == hdl->fmt)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (ioctl(hdl->fd, SNDCTL_DSP_SPEED, &hdl->rate) < 0) {
|
if (ioctl(hdl->fd, SNDCTL_DSP_SPEED, &hdl->rate) < 0) {
|
||||||
DPERROR("sio_oss_setpar: SPEED");
|
DPERROR("sio_oss_setpar: SPEED");
|
||||||
hdl->sio.eof = 1;
|
hdl->sio.eof = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user