Skip to content

Commit

Permalink
Fix construction of signed CAB header
Browse files Browse the repository at this point in the history
Commit 0f51a06 ("Separate common and format-dependent functions")
performed a substantial amount of refactoring.  Within the CFFOLDER
header construction loop in cab_add_header(), the line

   tmp = GET_UINT32_LE(indata + i);

seems to have been accidentally deleted, instead of being refactored
to become

   tmp = GET_UINT32_LE(ctx->options->indata + i);

with the result that adding a signature to a .cab file will currently
produce an invalid .cab file.

Fix by adding back in the missing line of code.

Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
  • Loading branch information
mcb30 authored and mtrojnar committed Aug 31, 2023
1 parent 1fc2c93 commit 5b8376c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cab.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ static int cab_add_header(FILE_FORMAT_CTX *ctx, BIO *hash, BIO *outdata)
*/
nfolders = GET_UINT16_LE(ctx->options->indata + 26);
while (nfolders) {
tmp = GET_UINT32_LE(ctx->options->indata + i);
tmp += 24;
PUT_UINT32_LE(tmp, buf);
BIO_write(hash, buf, 4);
Expand Down

0 comments on commit 5b8376c

Please sign in to comment.