34 lines
1.1 KiB
Diff
34 lines
1.1 KiB
Diff
From c01495f91ac71c5205f52713430b68e80d851149 Mon Sep 17 00:00:00 2001
|
|
From: Cristy <urban-warrior@imagemagick.org>
|
|
Date: Sat, 5 Oct 2019 08:56:29 -0400
|
|
Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1721
|
|
|
|
---
|
|
magick/string.c | 6 ++++--
|
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/magick/string.c b/magick/string.c
|
|
index f6f7b9318..1b47f562e 100644
|
|
--- a/magick/string.c
|
|
+++ b/magick/string.c
|
|
@@ -2534,7 +2534,7 @@ MagickExport MagickBooleanType SubstituteString(char **string,
|
|
{
|
|
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.
|
|
@@ -2562,7 +2562,9 @@ MagickExport MagickBooleanType SubstituteString(char **string,
|
|
(void) memmove(p+replace_extent,p+search_extent,
|
|
strlen(p+search_extent)+1);
|
|
(void) memcpy(p,replace,replace_extent);
|
|
- p+=replace_extent-1;
|
|
+ p+=replace_extent;
|
|
+ if (replace_extent != 0)
|
|
+ p--;
|
|
}
|
|
return(status);
|
|
}
|