File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -1677,7 +1677,6 @@ MagickExport size_t InterpretImageFilename(const ImageInfo *image_info,
1677
1677
canonical ;
1678
1678
1679
1679
ssize_t
1680
- field_width ,
1681
1680
offset ;
1682
1681
1683
1682
canonical = MagickFalse ;
@@ -1693,21 +1692,23 @@ MagickExport size_t InterpretImageFilename(const ImageInfo *image_info,
1693
1692
p ++ ;
1694
1693
continue ;
1695
1694
}
1696
- field_width = 0 ;
1697
- if (* q == '0' )
1698
- field_width = (ssize_t ) strtol (q ,& q ,10 );
1699
1695
switch (* q )
1700
1696
{
1701
1697
case 'd' :
1702
1698
case 'o' :
1703
1699
case 'x' :
1704
1700
{
1701
+ ssize_t
1702
+ count ;
1703
+
1705
1704
q ++ ;
1706
1705
c = (* q );
1707
1706
* q = '\0' ;
1708
- ( void ) FormatLocaleString (filename + (p - format - offset ),(size_t )
1707
+ count = FormatLocaleString (filename + (p - format - offset ),(size_t )
1709
1708
(MaxTextExtent - (p - format - offset )),p ,value );
1710
- offset += (4 - field_width );
1709
+ if ((count <= 0 ) || (count > (MagickPathExtent - (p - format - offset ))))
1710
+ return (0 );
1711
+ offset += (ssize_t ) ((q - p )- count );
1711
1712
* q = c ;
1712
1713
(void ) ConcatenateMagickString (filename ,q ,MaxTextExtent );
1713
1714
canonical = MagickTrue ;
You can’t perform that action at this time.
0 commit comments