Skip to content

Commit b10e8ba

Browse files
committed
fix romimg error
1 parent af00502 commit b10e8ba

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

tools/romimg/src/platform.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,5 @@ void upperbuff(char *temp);
1313
#else
1414
#define PATHSEP '/'
1515
#endif
16-
#ifndef MAX_PATH
17-
#define MAX_PATH 4096
18-
#endif
1916

2017
#endif /* __PLATFORM_H__ */

tools/romimg/src/romimg.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static int GetExtInfoStat(const struct ROMImgStat *ImageStat, struct RomDirFileF
143143
int 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

455455
int 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

Comments
 (0)