From c91d9e97a772257c7d33fcaf489162ce38b25c69 Mon Sep 17 00:00:00 2001 From: Andy Ragusa Date: Thu, 27 Jun 2024 13:06:53 -0700 Subject: [PATCH] Address feedback from code review --- libclamav/ole2_extract.c | 46 +++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/libclamav/ole2_extract.c b/libclamav/ole2_extract.c index 201f62dd60..9c181426eb 100644 --- a/libclamav/ole2_extract.c +++ b/libclamav/ole2_extract.c @@ -152,6 +152,30 @@ typedef struct property_tag { unsigned char reserved[4]; } property_t; + +/* + * File Information Block Base. + * Naming is consistent with + * https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-doc/26fb6c06-4e5c-4778-ab4e-edbf26a545bb + * */ +typedef struct __attribute__((packed)) fib_base_type { + uint16_t wIdent; + uint16_t nFib; + uint16_t unused; + uint16_t lid; + uint16_t pnNext; + uint16_t ABCDEFGHIJKLM; + uint16_t nFibBack; + uint32_t lKey; + uint8_t envr; + uint8_t NOPQRS; + uint16_t reserved3; + uint16_t reserved4; + uint32_t reserved5; + uint32_t reserved6; +} fib_base_t; + + struct ole2_list_node; typedef struct ole2_list_node { @@ -616,28 +640,6 @@ static int ole2_cmp_name(const char *const name, uint32_t name_size, const char return strcasecmp(decoded, keyword); } -/* - * File Information Block Base. - * Naming is consistent with - * https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-doc/26fb6c06-4e5c-4778-ab4e-edbf26a545bb - * */ -typedef struct fib_base_type { - uint16_t wIdent __attribute__((packed)); - uint16_t nFib; - uint16_t unused; - uint16_t lid; - uint16_t pnNext; - uint16_t ABCDEFGHIJKLM; - uint16_t nFibBack; - uint32_t lKey; - uint8_t envr; - uint8_t NOPQRS; - uint16_t reserved3; - uint16_t reserved4; - uint32_t reserved5; - uint32_t reserved6; -} fib_base_t; - static void copy_fib_base(fib_base_t *pFib, const uint8_t *const ptr) { memcpy(pFib, ptr, sizeof(fib_base_t));