From 756e2e07b1f04af2376edbe7868c91882269787a Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Sat, 22 Apr 2023 18:48:46 +0200 Subject: [PATCH] Fixed bug in 26900 module_hash_encode --- docs/changes.txt | 1 + src/modules/module_26900.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index aa0ef815d..8da7f3d7c 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -51,6 +51,7 @@ - Skip chained generated rules that exceed the maximum number of function calls - Fixed incorrect plaintext check for 25400 and 26610. Increased plaintext check to 32 bytes to prevent false positives. - Fixed bug in --stdout that caused certain rules to malfunction +- Fixed bug in 26900 module_hash_encode - Fixed build failed for 18400 with Apple Metal - Fixed build failed for 18600 with Apple Metal - Fixed display problem of the "Optimizers applied" list for algorithms using OPTI_TYPE_SLOW_HASH_SIMD_INIT2 and/or OPTI_TYPE_SLOW_HASH_SIMD_LOOP2 diff --git a/src/modules/module_26900.c b/src/modules/module_26900.c index 2d724b509..933918c27 100644 --- a/src/modules/module_26900.c +++ b/src/modules/module_26900.c @@ -282,7 +282,19 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE out_len++; - out_len += hex_encode ((u8 *) snmpv3->engineID_buf, snmpv3->engineID_len, out_buf + out_len); + // remove zero padding from snmpv3->engineID_buf + + u8 *engineID_buf_tmp = (u8 *) snmpv3->engineID_buf; + + u32 engineID_len = snmpv3->engineID_len; + + while (engineID_buf_tmp[engineID_len] == 0x00) engineID_len--; + + engineID_len++; + + // append to output + + out_len += hex_encode ((u8 *) snmpv3->engineID_buf, engineID_len, out_buf + out_len); out_buf[out_len] = '$';