Skip to content

Commit

Permalink
remove redundant path policy check
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Feb 3, 2023
1 parent 86b2f4d commit 591e29f
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions magick/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,20 +1009,7 @@ MagickExport char *FileToString(const char *filename,const size_t extent,
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
p=filename;
if ((*filename == '@') && (strlen(filename) > 1))
{
MagickBooleanType
status;

status=IsRightsAuthorized(PathPolicyDomain,ReadPolicyRights,filename);
if (status == MagickFalse)
{
errno=EPERM;
(void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
"NotAuthorized","`%s'",filename);
return((char *) NULL);
}
p=filename+1;
}
p=filename+1;
return((char *) FileToBlob(p,extent,&length,exception));
}

Expand Down Expand Up @@ -1056,6 +1043,9 @@ MagickExport char *FileToString(const char *filename,const size_t extent,
MagickExport StringInfo *FileToStringInfo(const char *filename,
const size_t extent,ExceptionInfo *exception)
{
const char
*p;

StringInfo
*string_info;

Expand All @@ -1065,7 +1055,10 @@ MagickExport StringInfo *FileToStringInfo(const char *filename,
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
string_info=AcquireStringInfoContainer();
(void) CopyMagickString(string_info->path,filename,MaxTextExtent);
string_info->datum=FileToBlob(filename,extent,&string_info->length,exception);
p=filename;
if ((*filename == '@') && (strlen(filename) > 1))
p=filename+1;
string_info->datum=FileToBlob(p,extent,&string_info->length,exception);
if (string_info->datum == (unsigned char *) NULL)
{
string_info=DestroyStringInfo(string_info);
Expand Down

0 comments on commit 591e29f

Please sign in to comment.