Skip to main content
Sign in
Snippets Groups Projects
Commit 032a07e7 authored by Ronny Nilsson's avatar Ronny Nilsson
Browse files

brcm_fw_tool: checksum of file name were incorrectly calculated.

This i likely a very old bug.
parent 6df0d47f
No related branches found
No related tags found
No related merge requests found
...@@ -38,6 +38,7 @@ int gen_image_jffs2(const char *in_file, char *sequence_number) ...@@ -38,6 +38,7 @@ int gen_image_jffs2(const char *in_file, char *sequence_number)
int possibly_jffs2 = 0; int possibly_jffs2 = 0;
int sequence; int sequence;
char fixed_sequence[16]; char fixed_sequence[16];
char name[256];
int ver_name_len = strlen(VERSION_NAME); int ver_name_len = strlen(VERSION_NAME);
if ((in_fp = open(in_file, O_RDWR)) < 0){ if ((in_fp = open(in_file, O_RDWR)) < 0){
...@@ -90,8 +91,10 @@ int gen_image_jffs2(const char *in_file, char *sequence_number) ...@@ -90,8 +91,10 @@ int gen_image_jffs2(const char *in_file, char *sequence_number)
if( pdir->version > version ) { if( pdir->version > version ) {
if( pdir->ino != 0 ) { if( pdir->ino != 0 ) {
if (verbose) { if (verbose) {
memcpy(name, pdir->name, pdir->nsize);
name[pdir->nsize] = 0;
printf("Found cferam structure at offset %x\n", (unsigned int)p); printf("Found cferam structure at offset %x\n", (unsigned int)p);
printf("name : %s\n",pdir->name); printf("name : %s\n",name);
printf("name_crc: %x\n",pdir->name_crc); printf("name_crc: %x\n",pdir->name_crc);
printf("nsize : %d\n",pdir->nsize); printf("nsize : %d\n",pdir->nsize);
printf("totlen : %d\n",pdir->totlen); printf("totlen : %d\n",pdir->totlen);
...@@ -127,9 +130,11 @@ end: ...@@ -127,9 +130,11 @@ end:
} }
memcpy(pdir->name+7, fixed_sequence, 3); memcpy(pdir->name+7, fixed_sequence, 3);
pdir->name_crc = crc32(0, pdir->name, strlen((char*)pdir->name)); pdir->name_crc = crc32(0, pdir->name, pdir->nsize);
if (verbose) { if (verbose) {
printf("new name : %s sn: %s\n",pdir->name, fixed_sequence); memcpy(name, pdir->name, pdir->nsize);
name[pdir->nsize] = 0;
printf("new name : %s sn: %s\n", name, fixed_sequence);
printf("new name_crc: %x\n",pdir->name_crc); printf("new name_crc: %x\n",pdir->name_crc);
} }
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment