Skip to content
Permalink
Browse files
Fixed buffer overflow in CD-ROM detection code.
  • Loading branch information
icculus committed Jun 29, 2002
1 parent 4dce6ee commit 3df9dda733101446bdf8a846d45fa050396cfb68
Showing with 9 additions and 9 deletions.
  1. +1 −1 platform/macclassic.c
  2. +8 −8 platform/unix.c
@@ -119,7 +119,7 @@ char **__PHYSFS_platformDetectAvailableCDs(void)
hpbr.volumeParam.ioVolIndex = 0;
if (PBHGetVInfoSync(&hpbr) == noErr)
{
char **tmp = realloc(retval, sizeof (char *) * cd_count + 1);
char **tmp = realloc(retval, sizeof (char *) * (cd_count + 1));
if (tmp)
{
char *str = (char *) malloc(volName[0] + 1);
@@ -91,15 +91,15 @@ char **__PHYSFS_platformDetectAvailableCDs(void)

if (add_it)
{
char **tmp = realloc(retval, sizeof (char *) * cd_count + 1);
char **tmp = realloc(retval, sizeof (char *) * (cd_count + 1));
if (tmp)
{
retval = tmp;
retval[cd_count-1] = (char *)
malloc(strlen(mntbufp[ ii ].f_mntonname) + 1);
if (retval[cd_count-1])
retval[cd_count - 1] = (char *)
malloc(strlen(mntbufp[ii].f_mntonname) + 1);
if (retval[cd_count - 1])
{
strcpy(retval[cd_count-1], mntbufp[ ii ].f_mntonname);
strcpy(retval[cd_count - 1], mntbufp[ii].f_mntonname);
cd_count++;
} /* if */
} /* if */
@@ -137,14 +137,14 @@ char **__PHYSFS_platformDetectAvailableCDs(void)

if (add_it)
{
char **tmp = realloc(retval, sizeof (char *) * cd_count + 1);
char **tmp = realloc(retval, sizeof (char *) * (cd_count + 1));
if (tmp)
{
retval = tmp;
retval[cd_count-1] = (char *) malloc(strlen(ent->mnt_dir) + 1);
if (retval[cd_count-1])
if (retval[cd_count - 1])
{
strcpy(retval[cd_count-1], ent->mnt_dir);
strcpy(retval[cd_count - 1], ent->mnt_dir);
cd_count++;
} /* if */
} /* if */

0 comments on commit 3df9dda

Please sign in to comment.