Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Feb 4, 2023
1 parent 591e29f commit 1c5c8e9
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions magick/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,20 @@ MagickExport char *FileToString(const char *filename,const size_t extent,
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
p=filename;
if ((*filename == '@') && (strlen(filename) > 1))
p=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;
}
return((char *) FileToBlob(p,extent,&length,exception));
}

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

0 comments on commit 1c5c8e9

Please sign in to comment.