Skip to content

Commit

Permalink
Use the correct rights.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Sep 11, 2021
1 parent 10c0f5b commit 428e685
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion magick/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ MagickExport MagickBooleanType OpenModule(const char *module,
p=GetCoderInfo(module,exception);
if (p != (CoderInfo *) NULL)
(void) CopyMagickString(module_name,p->name,MaxTextExtent);
rights=AllPolicyRights;
rights=ReadPolicyRights|WritePolicyRights;
if (IsRightsAuthorized(ModulePolicyDomain,rights,module_name) == MagickFalse)
{
errno=EPERM;
Expand Down
8 changes: 6 additions & 2 deletions magick/static.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ MagickExport MagickBooleanType RegisterStaticModule(const char *module,
p=GetCoderInfo(module,exception);
if (p != (CoderInfo *) NULL)
(void) CopyMagickString(module_name,p->name,MagickPathExtent);
rights=AllPolicyRights;
rights=ReadPolicyRights|WritePolicyRights;
if (IsRightsAuthorized(ModulePolicyDomain,rights,module_name) == MagickFalse)
{
errno=EPERM;
Expand Down Expand Up @@ -441,18 +441,22 @@ MagickExport MagickBooleanType RegisterStaticModule(const char *module,
*/
MagickExport void RegisterStaticModules(void)
{
PolicyRights
rights;

size_t
extent;

ssize_t
i;

rights=ReadPolicyRights|WritePolicyRights;
extent=sizeof(MagickModules)/sizeof(MagickModules[0]);
for (i=0; i < (ssize_t) extent; i++)
{
if (MagickModules[i].registered == MagickFalse)
{
if (IsRightsAuthorized(ModulePolicyDomain,AllPolicyRights,
if (IsRightsAuthorized(ModulePolicyDomain,rights,
MagickModules[i].module) == MagickFalse)
continue;
(void) (MagickModules[i].register_module)();
Expand Down

0 comments on commit 428e685

Please sign in to comment.