Don't generate EINVAL for data_len too big in READTOCENTRYS, it

reduces automatically to reasonable value in the code below
This commit is contained in:
Andrey A. Chernov 1996-01-30 12:07:15 +00:00
parent 2f3cc4bf87
commit 685a5a0b51
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13738
3 changed files with 7 additions and 10 deletions

View file

@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: mcd.c,v 1.59 1996/01/23 22:55:08 joerg Exp $
* $Id: mcd.c,v 1.60 1996/01/30 10:31:06 ache Exp $
*/
static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@ -1433,9 +1433,8 @@ mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te)
struct ioc_toc_header th;
int rc, n, trk, len = te->data_len;
if ( len > sizeof(entries)
|| len < sizeof(struct cd_toc_entry)
|| (len % sizeof(struct cd_toc_entry)) != 0
if ( len < sizeof(entries[0])
|| (len % sizeof(entries[0])) != 0
)
return EINVAL;
if (te->address_format != CD_MSF_FORMAT &&

View file

@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: mcd.c,v 1.59 1996/01/23 22:55:08 joerg Exp $
* $Id: mcd.c,v 1.60 1996/01/30 10:31:06 ache Exp $
*/
static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@ -1433,9 +1433,8 @@ mcd_toc_entrys(int unit, struct ioc_read_toc_entry *te)
struct ioc_toc_header th;
int rc, n, trk, len = te->data_len;
if ( len > sizeof(entries)
|| len < sizeof(struct cd_toc_entry)
|| (len % sizeof(struct cd_toc_entry)) != 0
if ( len < sizeof(entries[0])
|| (len % sizeof(entries[0])) != 0
)
return EINVAL;
if (te->address_format != CD_MSF_FORMAT &&

View file

@ -765,8 +765,7 @@ int wcdioctl (dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
if (! t->toc.hdr.ending_track)
return (EIO);
if ( te->data_len > sizeof(toc->tab)
|| te->data_len < sizeof(toc->tab[0])
if ( te->data_len < sizeof(toc->tab[0])
|| (te->data_len % sizeof(toc->tab[0])) != 0
)
return EINVAL;