Fix a bad bug where we were requesting potentially a huge number of blocks

(-1 unsigned). Fix both the driver to disallow such a nonsensical thing as well
as just don't make the request.
This commit is contained in:
rocky
2005-01-09 00:47:07 +00:00
parent 8b4a97cd46
commit 64addbf50c
2 changed files with 10 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cooked_interface.c,v 1.7 2005/01/08 20:39:40 rocky Exp $ $Id: cooked_interface.c,v 1.8 2005/01/09 00:47:07 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
Original interface.c Copyright (C) 1994-1997 Original interface.c Copyright (C) 1994-1997
@@ -80,7 +80,7 @@ cooked_read (cdrom_drive_t *d, void *p, lsn_t begin, long sectors)
char *buffer=(char *)p; char *buffer=(char *)p;
/* read d->nsectors at a time, max. */ /* read d->nsectors at a time, max. */
sectors=( sectors > d->nsectors ? d->nsectors : sectors); sectors=( sectors > d->nsectors && d->nsectors > 0 ? d->nsectors : sectors);
retry_count=0; retry_count=0;

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_sunos.c,v 1.3 2005/01/01 15:08:48 rocky Exp $ $Id: _cdio_sunos.c,v 1.4 2005/01/09 00:47:07 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -38,7 +38,7 @@
#ifdef HAVE_SOLARIS_CDROM #ifdef HAVE_SOLARIS_CDROM
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.3 2005/01/01 15:08:48 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.4 2005/01/09 00:47:07 rocky Exp $";
#ifdef HAVE_GLOB_H #ifdef HAVE_GLOB_H
#include <glob.h> #include <glob.h>
@@ -205,7 +205,12 @@ _read_audio_sectors_solaris (void *p_user_data, void *data, lsn_t lsn,
cdio_debug ("reading %d", lsn); cdio_debug ("reading %d", lsn);
p_env->gen.ioctls_debugged++; p_env->gen.ioctls_debugged++;
if (nblocks > 60) {
cdio_warn("%s:\n",
"we can't handle reading more than 60 blocks. Reset to 60");
}
cdda.cdda_addr = lsn; cdda.cdda_addr = lsn;
cdda.cdda_length = nblocks; cdda.cdda_length = nblocks;
cdda.cdda_data = (caddr_t) data; cdda.cdda_data = (caddr_t) data;