Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
47239db
fix(server): memory handling in the server mdns implementation
nogryy Dec 4, 2023
66eb2d1
feat(core): Add a consistency check to UA_Array_copy
jpfr Dec 5, 2023
16a182e
fix(core): Reset sequence numbers in UA_SecureChannel_close
jpfr Dec 15, 2023
fe54153
fix(server): Add required locks to readSessionDiagnostics
jpfr Feb 20, 2024
05b48e4
Use correct address when reading array members of session diagnostic …
the-om Feb 19, 2024
cb77551
adding floating point number representation for ESP platform
m-obi Mar 4, 2024
2405c65
Bump version to 1.3.10
jpfr Apr 8, 2024
239aaff
fix(server): Add missing lock handling for the subscription diagnostics
jpfr May 13, 2024
1d5066d
refactor(core): Bump version to 1.3.11
jpfr May 13, 2024
548a2ef
fix(server) check history backend for event support in history-read s…
andreasebner Jun 21, 2024
8d7fabc
refactor(deps): Use only base64 routines under the BSD license
jpfr Aug 2, 2024
8eacb3f
Merge remote-tracking branch 'origin/1.2' into 1.3
jpfr Aug 2, 2024
fc1c61f
Merge pull request #6633 from jpfr/merge_12_13_11
jpfr Aug 2, 2024
5131c69
feat(deps): Better validation during base64 decoding
jpfr Aug 2, 2024
253fcab
fix(tests): Fix decoding of bad JSON
jpfr Aug 2, 2024
1354f73
Merge remote-tracking branch 'origin/1.2' into merge_12_13_12
jpfr Aug 2, 2024
697b5d1
Merge pull request #6636 from jpfr/merge_12_13_12
jpfr Aug 2, 2024
d445afa
Fix binary encoding and decoding for DiagnosticInfo
basyskom-jvoe Aug 5, 2024
0a522e4
fix(server): Fix a build error for the historizing feature
jpfr Aug 7, 2024
73dc1b0
fix(deps): Fix a (false positive) type conversion warning in base64.c
jpfr Aug 7, 2024
07f5f40
fix(deps): Fix a (false positive) type conversion warning in base64.c
jpfr Aug 7, 2024
41ee330
fix(deps): Re-enable support for empty base64 strings
jpfr Aug 8, 2024
13d10a8
Merge remote-tracking branch 'origin/1.2' into empty_base64
jpfr Aug 8, 2024
6578d60
Merge pull request #6647 from jpfr/empty_base64
jpfr Aug 8, 2024
a7f5371
refactor(build): Bump version to v1.2.10
jpfr Aug 9, 2024
d5a35a4
Merge remote-tracking branch 'origin/1.2' into merge_12_13_13
jpfr Aug 9, 2024
f938577
refactor(build): Bump version to v1.3.12
jpfr Aug 9, 2024
3dd3cdf
Merge pull request #6651 from jpfr/merge_12_13_13
jpfr Aug 9, 2024
f5de42a
fix(server): Select the right sp to check userTokenSignature
Maddin-619 Aug 26, 2024
acbf684
fix(core): add UA_EXPORT for UA_DataType_getStructMember
ralphlange Sep 2, 2024
317819b
fix(plugin): Avoid memmory read access errors (#6688)
soekkle Sep 10, 2024
9b6848a
fix(plugin): Proper error handling when checking all CRLs
Sep 10, 2024
083e4e9
fix(core): Fix UA_EXPORT annotations for UA_DataType handling
jpfr Sep 11, 2024
e613a90
feat(core) update mdnsd submodule refernce
andreasebner Jan 18, 2024
44e1987
fix(ci): Fix azure pipeline build for 1.3
NoelGraf Sep 16, 2024
24de478
fix(ci): Updates azure pipelines
GoetzGoerisch Jan 11, 2023
eb7e427
fix(ci): Adapts install script to ubuntu-20.04
GoetzGoerisch Jan 11, 2023
bb20fb7
refactor(build): Switch to x64 VS2019 builds
jpfr Dec 23, 2023
5d5ab15
refactor(ci): Pin vcpkg triplet to x64-windows-static
jpfr Dec 24, 2023
46b1d0d
fix(ci): Add bcrypt library for windows
keba-estr Sep 12, 2024
d04e815
fix(test): Remove use of raw sleep() in all unit tests
jpfr Dec 24, 2023
2c9b91a
refactor(ci): Don't use DrMemory on Azure, takes too long
jpfr Dec 24, 2023
f4af493
fix(core): LibreSSL 3.5
ccvca Jun 3, 2022
86db884
fix(deps): Bump LibreSSL to 3.7.2
NoelGraf Sep 13, 2024
f199580
fix(plugin): Proper error handling when checking parent CRL for the m…
NoelGraf Sep 12, 2024
90661da
feat(test): Add test cases for CRL validation
NoelGraf Sep 11, 2024
af1abb2
refactor(plugins): Better cleanup of the OpenSSL CertificateVerificat…
jpfr Sep 22, 2024
ee79096
fix(plugin): Always clean up the previously configured certificate ve…
jpfr Sep 22, 2024
19ecf3e
refactor(plugin): Manual OpenSSL certificate verification steps
jpfr Sep 22, 2024
01086d6
refactor(plugins): Refactor mbedTLS certificate verification to inclu…
jpfr Sep 24, 2024
c63520c
refactor(plugins): Use the same certificate verification logic for mb…
jpfr Sep 27, 2024
dfe4eea
fix(core): Fix type access when comparing ExtensionObjects
jpfr Sep 29, 2024
f9d4c16
fix(plugins): More thorough validation that the issuer is a valid CA
jpfr Sep 27, 2024
47336a7
refactor(build): Bump version to v1.3.13
jpfr Oct 2, 2024
0a48591
fix(plugins): Disable the Basic128Rsa15 and Basic256 SecurityPolicy
jpfr Oct 3, 2024
43afb04
refactor(build): Bump version to 1.3.14
jpfr Oct 3, 2024
96fbfc8
fix(tests): Add a missing include to check_crl_validation.c (required…
jpfr Oct 22, 2024
db91b23
fix(plugins): Manually classify certificates as CA for OpenSSL
jpfr Oct 22, 2024
b947352
refactor(core): Validate Variant ArrayLength against its ArrayDimensi…
jpfr Oct 22, 2024
cd9088a
refactor(plugins): Refactor out mbedtlsSameBuf to compare mbedTLS buf…
jpfr Nov 23, 2024
ff7dc78
refactor(plugins): Small cleanups in ua_pki_mbedtls.c
jpfr Nov 23, 2024
3ebc92e
fix(plugins): Also consider the trustlist to find issuers in ua_pki_m…
jpfr Nov 23, 2024
2e516fd
fix(plugins): Return detailed status codes for revocation checks in u…
jpfr Nov 23, 2024
486a65e
fix(plugins): Also consider the trustlist to find issuers in ua_pki_o…
jpfr Nov 23, 2024
80bbdd4
fix(plugins): Return detailed status codes for revocation checks in u…
jpfr Nov 23, 2024
efbaac0
feat(plugins): Disable revocation lists checks in ua_pki_mbedtls.c if…
jpfr Nov 23, 2024
6814248
feat(plugins): Disable revocation lists checks in ua_pki_openssl.c if…
jpfr Nov 23, 2024
3eed1a6
refactor(build): Bump version to v1.3.15
jpfr Nov 23, 2024
86aa417
refactor(examples): do not set an invalid IP in server_multicast.c
laroche Jan 1, 2025
491667a
feat(client): Check if the "CreatedAt" timestamp of the SecurityToken…
jpfr Feb 3, 2025
087039e
feat(ci): remove ubuntu-20.04 ci
marwinglaser Feb 18, 2025
22d60f1
fix(ci): update tpm2-tss and tpm2-pkcs11 to fix TPM Tool Build
marwinglaser Mar 11, 2025
0767779
fix(ci): switch to clang-14 to fix clang build
marwinglaser Mar 11, 2025
d293259
fix(ci): Fix an ill-defined regex in valgrind_check_error.py
NoelGraf Oct 17, 2023
f279e93
fix(ci): disable pubsub ethernet support for tcc
marwinglaser Mar 18, 2025
5c1882c
fix(ci): suppress invalid valgrind report in pthread_create in tests
marwinglaser Mar 25, 2025
e1b2fee
fic(ci) run linux CI in an ubuntu container (#7225)
marwinglaser Apr 15, 2025
a540be9
fix(test): client async connect is not instant
bluhm Apr 22, 2025
4874837
fix(client): use after free in client asyncServiceCalls
bluhm Jul 20, 2022
62122ca
fix(server): Check the NodeClass before processing an async method
jpfr May 27, 2025
ce345f9
fix(server): Check access rights for async method execution
jpfr May 27, 2025
02fbcc2
feat(tests): Add a test for UA_Server_getSessionParameter
jpfr May 27, 2025
199a59a
fix(server): Fix a locking issue in browseWithContinuation
jpfr Oct 9, 2025
d10add6
fix(core): Ensure that only quiet NAN are used for float/double
jpfr Sep 29, 2024
f1eed9d
fix(build): Pacify compiler warnings related to goto (but harmless)
jpfr Oct 8, 2025
59d7cc5
fix(plugins): Pacify a clang warning in ua_pki_mbedtls.c
jpfr Oct 8, 2025
e5a7dc0
refactor(build): Bump the release version to v1.3.16
jpfr Oct 20, 2025
1aceacf
fix(plugins): Use the session parameters feature instead of storing d…
jpfr Nov 5, 2025
51ff659
fix(plugin): fix namelist allocated from scandir not freed
Tassenpudding May 19, 2025
ff411f0
fix(server): Avoid comparing a scalar value and a null-array when det…
dpazj Jan 14, 2026
41f4dee
refactor(build): Bump version to v1.3.17
jpfr Feb 2, 2026
d6fb639
fix(client): update status codes for error masking
aaghash17 Mar 9, 2026
20b9990
fix(server): Apply allowBrowseNode access control in TranslateBrowseP…
o6-nbeier May 7, 2026
6f58e2c
fix(client): Return the precise statuscode when triggering a reconnect
o6-jpfr Jun 24, 2026
bdc9497
fix(tests): Fix an endless loop on CI runs
o6-jpfr Jun 24, 2026
683bb38
fix(build): Ensure the check library is found on MacOS
o6-jpfr Jun 24, 2026
9e0d238
fix(core): Fix integer overflow in array decoding
Feb 11, 2026
0eb7d97
fix(pubsub): Guard DataSetPayload JSON field count against UA_UInt16 …
o6-nbeier May 7, 2026
435ac16
fix(build): Fix FindCheck for cross-arch builds
o6-jpfr Jun 27, 2026
db393f2
refactor(build): Bump version to v1.3.18
jpfr Jun 28, 2026
7cf493e
fix(core): use correct size in memset after moving Variant array elem…
lonelybones Mar 31, 2026
9c1636a
fix(server): Cap default outstanding PublishRequest count per session
o6-nbeier Apr 28, 2026
8098907
fix(core): reject overflowing arrayDimensions product in Variant en/d…
o6-nbeier May 11, 2026
a1257fe
fix(pubsub): check message length before signature size subtraction
o6-nbeier May 11, 2026
2da371b
fix(server): migrate samplingMonitoredItems in TransferSubscriptions
o6-nbeier May 11, 2026
00c4854
refactor(build): Bump version to v1.3.19
jpfr Jul 27, 2026
1153238
Merge tag 'v1.3.19' into update_to_1_3_19
FreddieAkeroyd Jul 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .azure-pipelines/azure-pipelines-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
- job: 'dist_debian'
displayName: 'Dist (debian)'
pool:
vmImage: 'ubuntu-18.04'
vmImage: 'ubuntu-20.04'
steps:
- checkout: self
submodules: recursive
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/azure-pipelines-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
- job: 'cross_freeRTOS'
displayName: 'Arch (freeRTOS)'
pool:
vmImage: 'ubuntu-18.04'
vmImage: 'ubuntu-20.04'
variables:
IDF_PATH: $(Build.BinariesDirectory)/esp-idf
steps:
Expand Down
34 changes: 26 additions & 8 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
matrix:
include:
- build_name: "Debug Build & Unit Tests (gcc)"
cmd_deps: sudo apt-get install -y -qq mosquitto
cmd_action: unit_tests
- build_name: "Debug Build & Unit Tests without Subscriptions (gcc)"
cmd_deps: ""
Expand All @@ -24,10 +23,10 @@ jobs:
cmd_deps: ""
cmd_action: unit_tests_alarms
- build_name: "Debug Build & Unit Tests (clang)"
cmd_deps: sudo apt-get install -y -qq clang-11 clang-tools-11 mosquitto
cmd_deps: sudo apt-get install -y -qq clang-11 clang-tools-11
cmd_action: CC=clang-11 CXX=clang++-11 unit_tests
- build_name: "Debug Build & Unit Tests (tcc)"
cmd_deps: sudo apt-get install -y -qq tcc mosquitto
cmd_deps: sudo apt-get install -y -qq tcc
cmd_action: CC=tcc unit_tests
- build_name: "Encryption (MbedTLS) Build & Unit Tests (gcc)"
cmd_deps: sudo apt-get install -y -qq libmbedtls-dev
Expand All @@ -41,9 +40,9 @@ jobs:
- build_name: "Encryption (LibreSSL) Build & Unit Tests (gcc)"
cmd_deps: |
sudo apt-get install -y -qq curl
curl https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.4.2.tar.gz --output libressl.tar.gz
curl https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.7.2.tar.gz --output libressl.tar.gz
tar -xvz -f libressl.tar.gz
cd libressl-3.4.2
cd libressl-3.7.2
./configure
sudo make install
cmd_action: unit_tests_encryption LIBRESSL
Expand Down Expand Up @@ -98,17 +97,36 @@ jobs:
cmd_deps: sudo apt-get install -y -qq clang-11 clang-tools-11 libmbedtls-dev
cmd_action: build_clang_analyzer
name: ${{matrix.build_name}}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/marwinglaser/ci:ubuntu-20.04
options: --privileged
services:
mosquitto:
image: eclipse-mosquitto:1.6-openssl
env:
OPEN62541_TEST_MQTT_BROKER: opc.mqtt://mosquitto:1883
steps:
- uses: actions/checkout@v2
- name: Work around disabled ipv6 on actions container networks
run: |
IPV6="$(cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6)"
echo "Current IPv6 status on eth0: $IPV6"
[ "$IPV6" = "1" ] || exit

echo 0 | sudo tee /proc/sys/net/ipv6/conf/eth0/disable_ipv6 > /dev/null
IPV6="$(cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6)"
echo "New IPv6 status on eth0: $IPV6"
[ "$IPV6" = "0" ] || { echo "Failed to enable IPv6 on eth0"; exit 1; }
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y -qq python3-sphinx graphviz check
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq cmake libcap2-bin pkg-config libssl-dev python3-sphinx graphviz check
${{ matrix.cmd_deps }}
- name: ${{matrix.build_name}}
shell: bash
run: source tools/ci.sh && ${{matrix.cmd_action}}
env:
ETHERNET_INTERFACE: eth0
Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/build_ubuntu2204.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,31 @@ jobs:
cmd_deps: sudo apt-get install -y -qq openssl
cmd_action: unit_tests_encryption OPENSSL
name: ${{matrix.build_name}}
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container:
image: ghcr.io/marwinglaser/ci:ubuntu-22.04
options: --privileged
steps:
- uses: actions/checkout@v2
- name: Work around disabled ipv6 on actions container networks
run: |
IPV6="$(cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6)"
echo "Current IPv6 status on eth0: $IPV6"
[ "$IPV6" = "1" ] || exit

echo 0 | sudo tee /proc/sys/net/ipv6/conf/eth0/disable_ipv6 > /dev/null
IPV6="$(cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6)"
echo "New IPv6 status on eth0: $IPV6"
[ "$IPV6" = "0" ] || { echo "Failed to enable IPv6 on eth0"; exit 1; }
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y -qq python3-sphinx graphviz check
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq cmake pkg-config libssl-dev python3-sphinx graphviz check
${{ matrix.cmd_deps }}
- name: ${{matrix.build_name}}
shell: bash
run: source tools/ci.sh && ${{matrix.cmd_action}}
env:
ETHERNET_INTERFACE: eth0
Expand Down
20 changes: 17 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# overwritten with more detailed information if git is available.
set(OPEN62541_VER_MAJOR 1)
set(OPEN62541_VER_MINOR 3)
set(OPEN62541_VER_PATCH 9)
set(OPEN62541_VER_PATCH 19)
set(OPEN62541_VER_LABEL "-undefined") # like "-rc1" or "-g4538abcd" or "-g4538abcd-dirty"
set(OPEN62541_VER_COMMIT "unknown-commit")

Expand Down Expand Up @@ -605,8 +605,12 @@ if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL)
# use the OpenSSL encryption library
# https://cmake.org/cmake/help/v3.0/module/FindOpenSSL.html
find_package(OpenSSL REQUIRED)
list(APPEND open62541_LIBRARIES ${OPENSSL_LIBRARIES})
endif ()
list(APPEND open62541_LIBRARIES "${OPENSSL_LIBRARIES}")
if(WIN32)
# Add bestcrypt for windows systems
list(APPEND open62541_LIBRARIES bcrypt)
endif()
endif()

if(UA_ENABLE_ENCRYPTION_LIBRESSL)
# See https://github.com/libressl-portable/portable/blob/master/FindLibreSSL.cmake
Expand All @@ -624,6 +628,10 @@ if(UA_ENABLE_ENCRYPTION_MBEDTLS OR UA_ENABLE_PUBSUB_ENCRYPTION)
# defined in /tools/cmake/FindMbedTLS.cmake.
find_package(MbedTLS REQUIRED)
list(APPEND open62541_LIBRARIES ${MBEDTLS_LIBRARIES})
if(WIN32)
# Add bestcrypt for windows systems
list(APPEND open62541_LIBRARIES bcrypt)
endif()
endif()

if(UA_ENABLE_TPM2_SECURITY)
Expand Down Expand Up @@ -695,6 +703,12 @@ if(NOT UA_FORCE_CPP AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" ST
# Use a strict subset of the C and C++ languages
check_add_cc_flag("-Wc++-compat")

# Wc++-compat enables additional goto/jump restrictions.
# But modern compilers do a detailed analysis of values
# are actually used uninitialized after a jump:
# TODO: The following flag should not be required
check_add_cc_flag("-Wno-jump-misses-init")

# Check that format strings (printf/scanf) are sane
check_add_cc_flag("-Wformat")
check_add_cc_flag("-Wformat-security")
Expand Down
121 changes: 69 additions & 52 deletions deps/base64.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* Base64 encoding: Copyright (c) 2005-2011, Jouni Malinen <j@w1.fi>
* This software may be distributed under the terms of the BSD license.
* Base64 encoding/decoding (RFC1341)
* Copyright (c) 2005-2011, Jouni Malinen <j@w1.fi>
*
* Base64 decoding: Copyright (c) 2016, polfosol
* Posted at https://stackoverflow.com/a/37109258 under the CC-BY-SA Creative
* Commons license.
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/

#include "base64.h"
Expand Down Expand Up @@ -55,61 +54,79 @@ UA_base64(const unsigned char *src, size_t len, size_t *out_len) {
return out;
}

static const uint32_t from_b64[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 63, 62, 62, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0,
0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 63,
0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51};
static unsigned char dtable[256] = {
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 62 , 0x80, 62 , 0x80, 63 ,
52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60 , 61 , 0x80, 0x80, 0x80, 0, 0x80, 0x80,
0x80, 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 ,
15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 0x80, 0x80, 0x80, 0x80, 63 ,
0x80, 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 ,
41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 50 , 51 , 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80
};

unsigned char *
UA_unbase64(const unsigned char *src, size_t len, size_t *out_len) {
// we need a minimum length
if(len <= 2) {
/* Empty base64 results in an empty byte-string */
if(len == 0) {
*out_len = 0;
return (unsigned char*)UA_EMPTY_ARRAY_SENTINEL;
}

const unsigned char *p = src;
size_t pad1 = len % 4 || p[len - 1] == '=';
size_t pad2 = pad1 && (len % 4 > 2 || p[len - 2] != '=');
const size_t last = (len - pad1) / 4 << 2;

unsigned char *str = (unsigned char*)UA_malloc(last / 4 * 3 + pad1 + pad2);
if(!str)
return NULL;

unsigned char *pos = str;
for(size_t i = 0; i < last; i += 4) {
uint32_t n = from_b64[p[i]] << 18 | from_b64[p[i + 1]] << 12 |
from_b64[p[i + 2]] << 6 | from_b64[p[i + 3]];
*pos++ = (unsigned char)(n >> 16);
*pos++ = (unsigned char)(n >> 8 & 0xFF);
*pos++ = (unsigned char)(n & 0xFF);
}
/* The input length must be a multiple of four */
if(len % 4 != 0)
return NULL;

/* Allocate the output string */
size_t olen = len / 4 * 3;
unsigned char *out = (unsigned char*)UA_malloc(olen);
if(!out)
return NULL;

if(pad1) {
if (last + 1 >= len) {
UA_free(str);
*out_len = 0;
return (unsigned char*)UA_EMPTY_ARRAY_SENTINEL;
}
uint32_t n = from_b64[p[last]] << 18 | from_b64[p[last + 1]] << 12;
*pos++ = (unsigned char)(n >> 16);
if(pad2) {
if (last + 2 >= len) {
UA_free(str);
*out_len = 0;
return (unsigned char*)UA_EMPTY_ARRAY_SENTINEL;
/* Iterate over the input */
size_t pad = 0;
unsigned char count = 0;
unsigned char block[4];
unsigned char *pos = out;
for(size_t i = 0; i < len; i++) {
unsigned char tmp = dtable[src[i]];
if(tmp == 0x80)
goto error; /* Invalid input */

if(src[i] == '=')
pad++;

block[count] = tmp;
count++;
if(count == 4) {
*pos++ = (unsigned char)((block[0] << 2) | (block[1] >> 4));
*pos++ = (unsigned char)((block[1] << 4) | (block[2] >> 2));
*pos++ = (unsigned char)((block[2] << 6) | block[3]);
if(pad) {
if(pad == 1)
pos--;
else if(pad == 2)
pos -= 2;
else
goto error; /* Invalid padding */
break;
}
n |= from_b64[p[last + 2]] << 6;
*pos++ = (unsigned char)(n >> 8 & 0xFF);
}
}
count = 0;
}
}

*out_len = (size_t)(pos - out);
return out;

*out_len = (uintptr_t)(pos - str);
return str;
error:
UA_free(out);
return NULL;
}
2 changes: 1 addition & 1 deletion deps/mdnsd
2 changes: 1 addition & 1 deletion examples/discovery/server_multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ int main(int argc, char **argv) {
config->mdnsConfig.mdnsServerName = UA_String_fromChars("Sample Multicast Server");

//setting custom outbound interface
config->mdnsInterfaceIP = UA_String_fromChars("42.42.42.42"); //this line will produce an error and set the interface to 0.0.0.0
config->mdnsInterfaceIP = UA_String_fromChars("0.0.0.0");

// See http://www.opcfoundation.org/UA/schemas/1.03/ServerCapabilities.csv
// For a LDS server, you should only indicate the LDS capability.
Expand Down
12 changes: 8 additions & 4 deletions include/open62541/architecture_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,11 @@ UA_STATIC_ASSERT(sizeof(bool) == 1, cannot_overlay_integers_with_large_bool);
* Float Endianness
* ^^^^^^^^^^^^^^^^
* The definition ``UA_FLOAT_IEEE754`` is set to true when the floating point
* number representation of the target architecture is IEEE 754. The definition
* ``UA_FLOAT_LITTLE_ENDIAN`` is set to true when the floating point number
* representation is in little-endian encoding. */

* number representation of the target architecture is IEEE 754. This can be
* set from outside with ``-DUA_FLOAT_IEEE754=1``.
* The definition ``UA_FLOAT_LITTLE_ENDIAN`` is set to true when the floating
* point number representation is in little-endian encoding. */
#ifndef UA_FLOAT_IEEE754
#if defined(_WIN32)
# define UA_FLOAT_IEEE754 1
#elif defined(__i386__) || defined(__x86_64__) || defined(__amd64__) || \
Expand All @@ -368,9 +369,12 @@ UA_STATIC_ASSERT(sizeof(bool) == 1, cannot_overlay_integers_with_large_bool);
# define UA_FLOAT_IEEE754 1
#elif defined(__STDC_IEC_559__)
# define UA_FLOAT_IEEE754 1
#elif defined(ESP_PLATFORM)
# define UA_FLOAT_IEEE754 1
#else
# define UA_FLOAT_IEEE754 0
#endif
#endif

/* Wikipedia says (https://en.wikipedia.org/wiki/Endianness): Although the
* ubiquitous x86 processors of today use little-endian storage for all types of
Expand Down
4 changes: 2 additions & 2 deletions include/open62541/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1078,12 +1078,12 @@ UA_DataType_getStructMember(const UA_DataType *type,
/* Test if the data type is a numeric builtin data type (via the typeKind field
* of UA_DataType). This includes integers and floating point numbers. Not
* included are Boolean, DateTime, StatusCode and Enums. */
UA_Boolean
UA_Boolean UA_EXPORT
UA_DataType_isNumeric(const UA_DataType *type);

/* Return the Data Type Precedence-Rank defined in Part 4.
* If there is no Precedence-Rank assigned with the type -1 is returned.*/
UA_Int16
UA_Int16 UA_EXPORT
UA_DataType_getPrecedence(const UA_DataType *type);

/**
Expand Down
Loading
Loading