summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/extractblocks_new.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/extractblocks_new.c b/src/extractblocks_new.c
index 53c16f2..c3fb899 100644
--- a/src/extractblocks_new.c
+++ b/src/extractblocks_new.c
@@ -89,11 +89,11 @@ int main( int args, char **argv )
89 df[i] = mf[i] ^ mantra[i%4]; 89 df[i] = mf[i] ^ mantra[i%4];
90 90
91 /* Get values from LHA header */ 91 /* Get values from LHA header */
92 header_len = df[0]; 92 header_len = df[0] + 2;
93 filename_len = df[21]; 93 filename_len = df[21];
94 94
95 /* Copy rest of header, so we can checksum */ 95 /* Copy rest of header, so we can checksum */
96 for( i=enc_len; i<header_len+2; ++i) 96 for( i=enc_len; i<header_len; ++i)
97 df[i] = mf[i]; 97 df[i] = mf[i];
98 98
99 /* Make up new sequental file name */ 99 /* Make up new sequental file name */
@@ -102,12 +102,12 @@ int main( int args, char **argv )
102 memcpy( ((uint8_t*)df) + 22, filename, filename_len); 102 memcpy( ((uint8_t*)df) + 22, filename, filename_len);
103 103
104 /* Recalculate checksum with new file name */ 104 /* Recalculate checksum with new file name */
105 df[1] = 0; for( i=2; i<header_len+2; ++i) df[1] += df[i]; 105 df[1] = 0; for( i=2; i<header_len; ++i) df[1] += df[i];
106 106
107 /* Open file and dump our de-"crypted" header and then rest of file */ 107 /* Open file and dump our de-"crypted" header and then rest of file */
108 i = open( filename, O_CREAT | O_TRUNC | O_WRONLY, 0644 ); 108 i = open( filename, O_CREAT | O_TRUNC | O_WRONLY, 0644 );
109 write( i, df, enc_len ); 109 write( i, df, header_len );
110 write( i, mf + enc_len, offset - oldoffset - enc_len ); 110 write( i, mf + header_len, offset - oldoffset - header_len );
111 close( i ); 111 close( i );
112 } 112 }
113 oldoffset = offset; 113 oldoffset = offset;