Fix possible unaligned memory accessses in stun.c on ARMv7

See #496
This commit is contained in:
emanuele-f
2025-03-22 16:41:58 +01:00
parent b20bf88660
commit 6b8ab97713
4 changed files with 16 additions and 4 deletions
+2 -2
View File
@@ -95,10 +95,10 @@
/* #undef NDPI_ENABLE_DEBUG_MESSAGES */
/* Last GIT change */
#define NDPI_GIT_DATE "Thu Jan 2 07:07:49 2025 +0100"
#define NDPI_GIT_DATE "Sat Mar 22 16:35:45 2025 +0100"
/* GIT Release */
#define NDPI_GIT_RELEASE "4.12.0-5032-46a2fbf"
#define NDPI_GIT_RELEASE "4.12.0-5035-ce606bf"
/* nDPI major release */
#define NDPI_MAJOR_RELEASE "4"
+12
View File
@@ -23,6 +23,9 @@
#ifndef __NDPI_DEFINE_INCLUDE_FILE__
#define __NDPI_DEFINE_INCLUDE_FILE__
#include <stdint.h>
#include <string.h>
/*
* The #define below is used for apps that dynamically link with nDPI to make
* sure that datastructures and in sync across versions
@@ -174,7 +177,16 @@
/* the get_uXX will return raw network packet bytes !! */
#define get_u_int8_t(X,O) (*(u_int8_t *)((&(((u_int8_t *)X)[O]))))
#define get_u_int16_t(X,O) (*(u_int16_t *)((&(((u_int8_t *)X)[O]))))
#if defined(__arm__)
static inline uint32_t get_u_int32_t(const uint8_t* X, int O)
{
uint32_t tmp;
memcpy(&tmp, X + O, sizeof(tmp));
return tmp;
}
#else
#define get_u_int32_t(X,O) (*(u_int32_t *)((&(((u_int8_t *)X)[O]))))
#endif // __arm__
#if defined(__arm__)
#include <stdint.h>
#include <string.h>
+1 -1
View File
@@ -3,7 +3,7 @@ set -e
# Set this to your NDK path
# Should match the ndkVersion in app/build.gradle
ANDROID_NDK="${ANDROID_NDK:-${HOME}/Android/Sdk/ndk}/26.1.10909125"
ANDROID_NDK="${ANDROID_NDK:-${HOME}/Android/Sdk/ndk}/26.3.11579264"
# https://developer.android.com/ndk/guides/other_build_systems
export TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64