Skip to content

Commit 66dc8f5

Browse files
author
Cristy
committed
https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-qh3h-j545-h8c9
1 parent a0bbad6 commit 66dc8f5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

MagickCore/image.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,6 @@ MagickExport size_t InterpretImageFilename(const ImageInfo *image_info,
16631663
canonical;
16641664

16651665
ssize_t
1666-
field_width,
16671666
offset;
16681667

16691668
canonical=MagickFalse;
@@ -1679,21 +1678,23 @@ MagickExport size_t InterpretImageFilename(const ImageInfo *image_info,
16791678
p++;
16801679
continue;
16811680
}
1682-
field_width=0;
1683-
if (*q == '0')
1684-
field_width=(ssize_t) strtol(q,&q,10);
16851681
switch (*q)
16861682
{
16871683
case 'd':
16881684
case 'o':
16891685
case 'x':
16901686
{
1687+
ssize_t
1688+
count;
1689+
16911690
q++;
16921691
c=(*q);
16931692
*q='\0';
1694-
(void) FormatLocaleString(filename+(p-format-offset),(size_t)
1693+
count=FormatLocaleString(filename+(p-format-offset),(size_t)
16951694
(MagickPathExtent-(p-format-offset)),p,value);
1696-
offset+=(4-field_width);
1695+
if ((count <= 0) || (count > (MagickPathExtent-(p-format-offset))))
1696+
return(0);
1697+
offset+=(ssize_t) ((q-p)-count);
16971698
*q=(char) c;
16981699
(void) ConcatenateMagickString(filename,q,MagickPathExtent);
16991700
canonical=MagickTrue;

0 commit comments

Comments
 (0)