From 833a580430abe0fbc9bc17a21fb95bf36dacf367 Mon Sep 17 00:00:00 2001 From: "Victor M. Alvarez" Date: Sun, 7 Apr 2024 17:22:10 +0200 Subject: [PATCH] Fix issue #2050. See also PR #2048. --- configure.ac | 3 --- libyara/proc/linux.c | 8 +++++--- tests/test-alignment.c | 2 ++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index bc23ee9fba..4a518f181e 100644 --- a/configure.ac +++ b/configure.ac @@ -32,9 +32,6 @@ AC_C_INLINE # Defines WORDS_BIGENDIAN if building in a big-endian host. AC_C_BIGENDIAN -# Arrange for 64-bit file offsets. -AC_SYS_LARGEFILE - LT_INIT AC_CANONICAL_HOST diff --git a/libyara/proc/linux.c b/libyara/proc/linux.c index 72f2ab48bc..9947d02001 100644 --- a/libyara/proc/linux.c +++ b/libyara/proc/linux.c @@ -29,6 +29,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #if defined(USE_LINUX_PROC) +#define _FILE_OFFSET_BITS 64 + #include #include #include @@ -249,7 +251,7 @@ YR_API const uint8_t* yr_process_fetch_memory_block_data(YR_MEMORY_BLOCK* block) // target process VM. if (fd == -1) { - if (pread64( + if (pread( proc_info->mem_fd, (void*) context->buffer, block->size, @@ -265,7 +267,7 @@ YR_API const uint8_t* yr_process_fetch_memory_block_data(YR_MEMORY_BLOCK* block) { goto _exit; } - if (pread64( + if (pread( proc_info->pagemap_fd, pagemap, sizeof(uint64_t) * block->size / page_size, @@ -284,7 +286,7 @@ YR_API const uint8_t* yr_process_fetch_memory_block_data(YR_MEMORY_BLOCK* block) // swap-backed and if it differs from our mapping. uint8_t buffer[page_size]; - if (pread64( + if (pread( proc_info->mem_fd, buffer, page_size, diff --git a/tests/test-alignment.c b/tests/test-alignment.c index 4bb950ad3d..d6c9b3c4ac 100644 --- a/tests/test-alignment.c +++ b/tests/test-alignment.c @@ -72,6 +72,8 @@ int main(int argc, char **argv) { YR_DEBUG_INITIALIZE(); + CHECK_SIZE(off_t, 8); + CHECK_SIZE(YR_SUMMARY, 12); CHECK_OFFSET(YR_SUMMARY, 0, num_rules); CHECK_OFFSET(YR_SUMMARY, 4, num_strings);