aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-02-19 00:01:18 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-02-19 00:01:18 +0100
commitf3648fefe040152bb1676d651ebf7d836cb8ac9e (patch)
treea656270416167c3a15e61f937c27093a7fb05bf0 /src/config.c
parent965db7e3243aecb02f7f57b4fe8dabe9ad50a697 (diff)
downloadBobinkCOpcUa-f3648fefe040152bb1676d651ebf7d836cb8ac9e.tar.gz
BobinkCOpcUa-f3648fefe040152bb1676d651ebf7d836cb8ac9e.zip
Refactor: reduce duplication and tighten helpers
- Remove redundant applicationUri log in print_application_description - Use UA_SECURITY_POLICY_NONE_URI macro instead of hardcoded string - Extract _s_register_with_lds / _s_deregister_from_lds helpers - Rename signal handler param 'sign' to 'sig' for consistency - Add INT_MIN/INT_MAX bounds check to config_require_int - Extract shared test helpers into tests/test_helpers.sh
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c
index 5f4d67a..2cee9d3 100644
--- a/src/config.c
+++ b/src/config.c
@@ -7,6 +7,7 @@
#include <open62541/plugin/log_stdout.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -192,7 +193,7 @@ config_require_int (const config *cfg, const char *key, const char *program)
char *endptr;
long num = strtol (val, &endptr, 10);
- if (*endptr != '\0')
+ if (*endptr != '\0' || num < INT_MIN || num > INT_MAX)
{
UA_LOG_FATAL (UA_Log_Stdout, UA_LOGCATEGORY_USERLAND,
"%s: config key '%s' is not a valid integer: '%s'",