Commit 452c4e917 for imagemagick.org
commit 452c4e9176b68156dc9bd58c027f9a28114fca63
Author: Cristy <urban-warrior@imagemagick.org>
Date: Sat Mar 14 14:51:48 2026 -0400
sanitize clip path name
diff --git a/MagickCore/image.c b/MagickCore/image.c
index 34d6104b3..d4d07c913 100644
--- a/MagickCore/image.c
+++ b/MagickCore/image.c
@@ -698,7 +698,8 @@ MagickExport MagickBooleanType ClipImagePath(Image *image,const char *pathname,
#define ClipImagePathTag "ClipPath/Image"
char
- *property;
+ *property,
+ *sanitized_pathname;
const char
*value;
@@ -728,8 +729,11 @@ MagickExport MagickBooleanType ClipImagePath(Image *image,const char *pathname,
image_info=AcquireImageInfo();
(void) CopyMagickString(image_info->filename,image->filename,
MagickPathExtent);
- (void) ConcatenateMagickString(image_info->filename,pathname,
+ (void) ConcatenateMagickString(image_info->filename,"_",MagickPathExtent);
+ sanitized_pathname=SanitizeString(pathname);
+ (void) ConcatenateMagickString(image_info->filename,sanitized_pathname,
MagickPathExtent);
+ sanitized_pathname=DestroyString(sanitized_pathname);
clip_mask=BlobToImage(image_info,value,strlen(value),exception);
image_info=DestroyImageInfo(image_info);
if (clip_mask == (Image *) NULL)