Code: Select all
This patch fixes a check that would otherwise always have evaluated to
"false". Since ConcatenateMagickString will never create a string the
strlen of which to be greater or equal than the specified maximum length
(due to the null terminator), ExpandFilenames always truncated filenames
silently.
---
magick/utility.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/magick/utility.c b/magick/utility.c
index 62c8006..58a9bbb 100644
--- a/magick/utility.c
+++ b/magick/utility.c
@@ -810,31 +810,31 @@ MagickExport MagickBooleanType ExpandFilenames(int *number_arguments,
/*
Transfer file list to argument vector.
*/
vector=(char **) ResizeQuantumMemory(vector,(size_t) *number_arguments+
count+number_files+1,sizeof(*vector));
if (vector == (char **) NULL)
return(MagickFalse);
for (j=0; j < (long) number_files; j++)
{
(void) CopyMagickString(filename,path,MaxTextExtent);
if (*path != '\0')
(void) ConcatenateMagickString(filename,DirectorySeparator,
MaxTextExtent);
(void) ConcatenateMagickString(filename,filelist[j],MaxTextExtent);
filelist[j]=DestroyString(filelist[j]);
- if (strlen(filename) >= MaxTextExtent)
+ if (strlen(filename) >= MaxTextExtent-1)
ThrowFatalException(OptionFatalError,"FilenameTruncated");
if (IsPathDirectory(filename) <= 0)
{
char
path[MaxTextExtent];
*path='\0';
if (*magick != '\0')
{
(void) ConcatenateMagickString(path,magick,MaxTextExtent);
(void) ConcatenateMagickString(path,":",MaxTextExtent);
}
(void) ConcatenateMagickString(path,filename,MaxTextExtent);
if (*subimage != '\0')
{
--
1.7.0.2.msysgit.1.891.gee59bc
Edit: looks like the workaround wasn't as simple as splitting up the -draw command-strings - draw settings are lost from one -draw to another.