From 90ad225a8c80dc5bbb6c48913210fa9a7fab81ce Mon Sep 17 00:00:00 2001 From: Sein Coray Date: Mon, 20 May 2019 19:49:32 +0200 Subject: [PATCH] enforcing checksum length which is printed to be length 4 always --- src/modules/module_17200.c | 4 ++-- src/modules/module_17210.c | 4 ++-- src/modules/module_17220.c | 4 ++-- src/modules/module_17230.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/module_17200.c b/src/modules/module_17200.c index 4b9abe2ba..7236b14d3 100644 --- a/src/modules/module_17200.c +++ b/src/modules/module_17200.c @@ -315,10 +315,10 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE out_len += sprintf (line_buf + out_len, "%x*%x*%x*%x*%x*", pkzip->hash.compressed_length, pkzip->hash.uncompressed_length, pkzip->hash.crc32, pkzip->hash.offset, pkzip->hash.additional_offset); } - out_len += sprintf (line_buf + out_len, "%i*%x*%x*", pkzip->hash.compression_type, pkzip->hash.data_length, pkzip->hash.checksum_from_crc); + out_len += sprintf (line_buf + out_len, "%i*%x*%04x*", pkzip->hash.compression_type, pkzip->hash.data_length, pkzip->hash.checksum_from_crc); if (pkzip->version == 2) { - out_len += sprintf (line_buf + out_len, "%x*", pkzip->hash.checksum_from_timestamp); + out_len += sprintf (line_buf + out_len, "%04x*", pkzip->hash.checksum_from_timestamp); } for (u32 i = 0; i < pkzip->hash.data_length / 4; i++) diff --git a/src/modules/module_17210.c b/src/modules/module_17210.c index 93722f1e4..2e1d90298 100644 --- a/src/modules/module_17210.c +++ b/src/modules/module_17210.c @@ -315,10 +315,10 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE out_len += sprintf (line_buf + out_len, "%x*%x*%x*%x*%x*", pkzip->hash.compressed_length, pkzip->hash.uncompressed_length, pkzip->hash.crc32, pkzip->hash.offset, pkzip->hash.additional_offset); } - out_len += sprintf (line_buf + out_len, "%i*%x*%x*", pkzip->hash.compression_type, pkzip->hash.data_length, pkzip->hash.checksum_from_crc); + out_len += sprintf (line_buf + out_len, "%i*%x*%04x*", pkzip->hash.compression_type, pkzip->hash.data_length, pkzip->hash.checksum_from_crc); if (pkzip->version == 2) { - out_len += sprintf (line_buf + out_len, "%x*", pkzip->hash.checksum_from_timestamp); + out_len += sprintf (line_buf + out_len, "%04x*", pkzip->hash.checksum_from_timestamp); } for (u32 i = 0; i < pkzip->hash.data_length / 4; i++) diff --git a/src/modules/module_17220.c b/src/modules/module_17220.c index 053639773..2b6c16bfa 100644 --- a/src/modules/module_17220.c +++ b/src/modules/module_17220.c @@ -318,10 +318,10 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE out_len += sprintf (line_buf + out_len, "%x*%x*%x*%x*%x*", pkzip->hashes[cnt].compressed_length, pkzip->hashes[cnt].uncompressed_length, pkzip->hashes[cnt].crc32, pkzip->hashes[cnt].offset, pkzip->hashes[cnt].additional_offset); } - out_len += sprintf (line_buf + out_len, "%i*%x*%x*", pkzip->hashes[cnt].compression_type, pkzip->hashes[cnt].data_length, pkzip->hashes[cnt].checksum_from_crc); + out_len += sprintf (line_buf + out_len, "%i*%x*%04x*", pkzip->hashes[cnt].compression_type, pkzip->hashes[cnt].data_length, pkzip->hashes[cnt].checksum_from_crc); if (pkzip->version == 2) { - out_len += sprintf (line_buf + out_len, "%x*", pkzip->hashes[cnt].checksum_from_timestamp); + out_len += sprintf (line_buf + out_len, "%04x*", pkzip->hashes[cnt].checksum_from_timestamp); } for (u32 i = 0; i < pkzip->hashes[cnt].data_length / 4; i++) diff --git a/src/modules/module_17230.c b/src/modules/module_17230.c index 39a1e4b20..649996f45 100644 --- a/src/modules/module_17230.c +++ b/src/modules/module_17230.c @@ -319,10 +319,10 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE out_len += sprintf (line_buf + out_len, "%x*%x*%x*%x*%x*", pkzip->hashes[cnt].compressed_length, pkzip->hashes[cnt].uncompressed_length, pkzip->hashes[cnt].crc32, pkzip->hashes[cnt].offset, pkzip->hashes[cnt].additional_offset); } - out_len += sprintf (line_buf + out_len, "%i*%x*%x*", pkzip->hashes[cnt].compression_type, pkzip->hashes[cnt].data_length, pkzip->hashes[cnt].checksum_from_crc); + out_len += sprintf (line_buf + out_len, "%i*%x*%04x*", pkzip->hashes[cnt].compression_type, pkzip->hashes[cnt].data_length, pkzip->hashes[cnt].checksum_from_crc); if (pkzip->version == 2) { - out_len += sprintf (line_buf + out_len, "%x*", pkzip->hashes[cnt].checksum_from_timestamp); + out_len += sprintf (line_buf + out_len, "%04x*", pkzip->hashes[cnt].checksum_from_timestamp); } for (u32 i = 0; i < pkzip->hashes[cnt].data_length / 4; i++)