Skip to content

Commit

Permalink
Fix issue #2050.
Browse files Browse the repository at this point in the history
See also PR #2048.
  • Loading branch information
plusvic committed Apr 7, 2024
1 parent 7b4dcd8 commit 833a580
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions libyara/proc/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <assert.h>
#include <errno.h>
#include <fcntl.h>
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions tests/test-alignment.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 833a580

Please sign in to comment.