mirror of
https://github.com/open62541/open62541.git
synced 2026-10-17 04:42:09 +08:00
c0277aa87c
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