Skip to content

Commit

Permalink
adfMount: a more complete parameter check.
Browse files Browse the repository at this point in the history
  • Loading branch information
t-w committed Jan 13, 2024
1 parent 202a6e8 commit d1b7130
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/adf_vol.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,22 @@ PREFIX struct AdfVolume * adfMount ( struct AdfDevice * const dev,
struct bBootBlock boot;
struct AdfVolume * vol;

if (dev==NULL || nPart >= dev->nVol) {
(*adfEnv.eFct)("adfMount : invalid parameter(s)");
if ( dev == NULL ) {
adfEnv.eFct ( "adfMount : invalid device (NULL)" );
return NULL;
}

if ( nPart < 0 ||
nPart >= dev->nVol )
{
adfEnv.eFct ( "adfMount : invalid partition %d", nPart );
return NULL;
}

if ( mode != ADF_ACCESS_MODE_READONLY &&
mode != ADF_ACCESS_MODE_READWRITE )
{
adfEnv.eFct ( "adfMount : invalid mode %d", mode );
return NULL;
}

Expand Down

0 comments on commit d1b7130

Please sign in to comment.