File ImageMagick-CVE-2020-27770.patch of Package ImageMagick.30956
Index: ImageMagick-6.8.8-1/magick/string.c
===================================================================
--- ImageMagick-6.8.8-1.orig/magick/string.c 2013-12-29 00:29:23.000000000 +0100
+++ ImageMagick-6.8.8-1/magick/string.c 2020-12-09 18:14:00.579605212 +0100
@@ -2676,7 +2676,7 @@ MagickExport MagickBooleanType Substitut
{
if (search_extent == 0)
search_extent=strlen(search);
- if (strncmp(p,search,search_extent) != 0)
+ if ((*p == *search) && (strncmp(p,search,search_extent) != 0))
continue;
/*
We found a match.
@@ -2704,7 +2704,9 @@ MagickExport MagickBooleanType Substitut
(void) CopyMagickMemory(p+replace_extent,p+search_extent,
strlen(p+search_extent)+1);
(void) CopyMagickMemory(p,replace,replace_extent);
- p+=replace_extent-1;
+ p+=replace_extent;
+ if (replace_extent != 0)
+ p--;
}
return(status);
}