@@ -194,11 +194,11 @@ mime_get_decode_file(uschar *pname, uschar *fname)
194194FILE * f = NULL ;
195195uschar * filename ;
196196
197- filename = (uschar * )malloc (2048 );
197+ filename = (uschar * )malloc (PATH_MAX );
198198
199199if (pname && fname )
200200 {
201- (void )string_format (filename , 2048 , "%s/%s" , pname , fname );
201+ (void )string_format (filename , PATH_MAX , "%s/%s" , pname , fname );
202202 f = modefopen (filename ,"wb+" ,SPOOL_MODE );
203203 }
204204else if (!pname )
@@ -212,7 +212,7 @@ else if (!fname)
212212 do
213213 {
214214 struct stat mystat ;
215- (void )string_format (filename , 2048 ,
215+ (void )string_format (filename , PATH_MAX ,
216216 "%s/%s-%05u" , pname , message_id , file_nr ++ );
217217 /* security break */
218218 if (file_nr >= 1024 )
@@ -236,8 +236,8 @@ mime_decode(const uschar **listptr)
236236int sep = 0 ;
237237const uschar * list = * listptr ;
238238uschar * option ;
239- uschar option_buffer [1024 ];
240- uschar decode_path [1024 ];
239+ uschar option_buffer [PATH_MAX ];
240+ uschar decode_path [PATH_MAX ];
241241FILE * decode_file = NULL ;
242242long f_pos = 0 ;
243243ssize_t size_counter = 0 ;
@@ -249,7 +249,7 @@ if (mime_stream == NULL)
249249f_pos = ftell (mime_stream );
250250
251251/* build default decode path (will exist since MBOX must be spooled up) */
252- (void )string_format (decode_path ,1024 ,"%s/scan/%s" ,spool_directory ,message_id );
252+ (void )string_format (decode_path ,PATH_MAX ,"%s/scan/%s" ,spool_directory ,message_id );
253253
254254/* try to find 1st option */
255255if ((option = string_nextinlist (& list , & sep ,
@@ -783,15 +783,15 @@ while(1)
783783 (Ustrncmp (mime_content_type ,"message/rfc822" ,14 ) == 0 ) )
784784 {
785785 const uschar * rfc822name = NULL ;
786- uschar filename [2048 ];
786+ uschar filename [PATH_MAX ];
787787 int file_nr = 0 ;
788788 int result = 0 ;
789789
790790 /* must find first free sequential filename */
791791 do
792792 {
793793 struct stat mystat ;
794- (void )string_format (filename , 2048 ,
794+ (void )string_format (filename , PATH_MAX ,
795795 "%s/scan/%s/__rfc822_%05u" , spool_directory , message_id , file_nr ++ );
796796 /* security break */
797797 if (file_nr >= 128 )
0 commit comments