@@ -143,7 +143,7 @@ static int GetExtInfoStat(const struct ROMImgStat *ImageStat, struct RomDirFileF
143143int CreateBlankROMImg (const char * filename , ROMIMG * ROMImg )
144144{
145145 unsigned int CommentLength ;
146- char LocalhostName [32 ] = "\0" , cwd [MAX_PATH ] = "\0" , UserName [32 ] = "\0" ;
146+ char LocalhostName [32 ] = { 0 } , cwd [PATH_MAX ] = { 0 } , UserName [32 ] = { 0 } ;
147147 struct FileEntry * ResetFile ;
148148 struct ExtInfoFieldEntry * ExtInfoEntry ;
149149
@@ -158,10 +158,10 @@ int CreateBlankROMImg(const char *filename, ROMIMG *ROMImg)
158158 GetLocalhostName (LocalhostName , sizeof (LocalhostName ));
159159 GetCurrentWorkingDirectory (cwd , sizeof (cwd ));
160160 /* Comment format: YYYYMMDD-XXXYYY,conffile,<filename>,<user>@<localhost>/<image path> */
161- CommentLength = IMAGE_COMMENT_BASESIZE + strlen (filename ) + sizeof (LocalhostName ) + sizeof (UserName ) + MAX_PATH ;
161+ CommentLength = IMAGE_COMMENT_BASESIZE + strlen (filename ) + sizeof (LocalhostName ) + sizeof (UserName ) + sizeof ( cwd ) ;
162162 ROMImg -> comment = (char * )malloc ( CommentLength + 1 );
163163 if (!ROMImg -> comment ) return ENOMEM ;
164- snprintf (ROMImg -> comment , CommentLength , "%08x,conffile,%s,%s@%s/%s" , ROMImg -> date , filename , BUFCHK ( UserName ), BUFCHK ( LocalhostName ) , cwd );
164+ snprintf (ROMImg -> comment , CommentLength , "%08x,conffile,%s,%s@%s/%s" , ROMImg -> date , filename , UserName , LocalhostName , cwd );
165165
166166 // Create a blank RESET file.
167167 ROMImg -> NumFiles = 1 ;
@@ -454,7 +454,7 @@ static int AddExtInfoStat(struct FileEntry *file, unsigned char type, void *data
454454
455455int AddFile (ROMIMG * ROMImg , const char * path , int upperconv )
456456{
457- char tbuf [10 ] = "\0" ; // we dont need a large buf, this is for filling in the filename on ROMFS
457+ char tbuf [9 ] = "\0" ; // we dont need a large buf, this is for filling in the filename on ROMFS
458458 FILE * InputFile ;
459459 int result ;
460460 unsigned int FileDateStamp ;
0 commit comments