Files
Niels Beier c0277aa87c fix(client): reserve SecurityPolicy array headroom to avoid reallocation
UA_ClientConfig_setDefaultEncryption reallocates config->securityPolicies.
A SecureChannel that is already open holds a raw pointer into that array
(e.g. to the "None" policy), so reallocating it -- which may move the
array -- left that pointer dangling and crashed on the next use.

UA_ClientConfig_setDefault now reserves enough headroom for the policies
UA_ClientConfig_setDefaultEncryption adds, so the common case of calling
it once needs no reallocation at all: the array's address never changes,
so an already-open channel's pointer stays valid. This also preserves
in-place updates to a policy already in use (e.g. UA_Server_updateCertificate
mutating a policy's certificate), which a previous per-channel-copy
approach would have hidden from already-open channels.

Fixes #6943
2026-09-24 08:46:45 +02:00
..