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 @@ -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 ;
You can’t perform that action at this time.
0 commit comments