Skip to content

Commit

Permalink
fix romimg error
Browse files Browse the repository at this point in the history
  • Loading branch information
israpps committed Nov 11, 2024
1 parent af00502 commit b10e8ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 0 additions & 3 deletions tools/romimg/src/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@ void upperbuff(char *temp);
#else
#define PATHSEP '/'
#endif
#ifndef MAX_PATH
#define MAX_PATH 4096
#endif

#endif /* __PLATFORM_H__ */
8 changes: 4 additions & 4 deletions tools/romimg/src/romimg.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static int GetExtInfoStat(const struct ROMImgStat *ImageStat, struct RomDirFileF
int CreateBlankROMImg(const char *filename, ROMIMG *ROMImg)
{
unsigned int CommentLength;
char LocalhostName[32] = "\0", cwd[MAX_PATH] = "\0", UserName[32] = "\0";
char LocalhostName[32] = {0}, cwd[PATH_MAX] = {0}, UserName[32] = {0};
struct FileEntry *ResetFile;
struct ExtInfoFieldEntry *ExtInfoEntry;

Expand All @@ -158,10 +158,10 @@ int CreateBlankROMImg(const char *filename, ROMIMG *ROMImg)
GetLocalhostName(LocalhostName, sizeof(LocalhostName));
GetCurrentWorkingDirectory(cwd, sizeof(cwd));
/* Comment format: YYYYMMDD-XXXYYY,conffile,<filename>,<user>@<localhost>/<image path> */
CommentLength = IMAGE_COMMENT_BASESIZE + strlen(filename) + sizeof(LocalhostName) + sizeof(UserName) + MAX_PATH;
CommentLength = IMAGE_COMMENT_BASESIZE + strlen(filename) + sizeof(LocalhostName) + sizeof(UserName) + sizeof(cwd);
ROMImg->comment = (char *)malloc( CommentLength+1);
if (!ROMImg->comment) return ENOMEM;
snprintf(ROMImg->comment, CommentLength, "%08x,conffile,%s,%s@%s/%s", ROMImg->date, filename, BUFCHK(UserName), BUFCHK(LocalhostName), cwd);
snprintf(ROMImg->comment, CommentLength, "%08x,conffile,%s,%s@%s/%s", ROMImg->date, filename, UserName, LocalhostName, cwd);

// Create a blank RESET file.
ROMImg->NumFiles = 1;
Expand Down Expand Up @@ -454,7 +454,7 @@ static int AddExtInfoStat(struct FileEntry *file, unsigned char type, void *data

int AddFile(ROMIMG *ROMImg, const char *path, int upperconv)
{
char tbuf[10] = "\0"; // we dont need a large buf, this is for filling in the filename on ROMFS
char tbuf[9] = "\0"; // we dont need a large buf, this is for filling in the filename on ROMFS
FILE *InputFile;
int result;
unsigned int FileDateStamp;
Expand Down

0 comments on commit b10e8ba

Please sign in to comment.