Publisher thread does not check use of NULL pointer
On current master (3caf833f160b
), launching the pubsub
sample in build/bin leads to NULL pointer dereference on sopc_network_layer.c:944
. However, depednding on host configuration, this may be simple silented or a single warning, or a thread stop.
The issue is that the configuration (./config_rtt_emitter.xml
) indicates securityMode="signAndEncrypt"
whereas no SKS is defined.
In Publisher MessageCtx_send_publish_message
, in case the SKS is NULL (L622), an ERROR log is shown but no action is taken and groupId remains NULL.
I see the following corrections:
- In case SKS is not resolved, the Publisher should not start.
- In Encoder, check that
security->groupKeys
is not NULL and returnSOPC_UADP_NetworkMessage_Error_Write_TokenId_Failed
or maybe a new codeSOPC_UADP_NetworkMessage_Error_Write_TokenId_Not_Set
- Moreover, in configuration sample, change the security to None, or set a valid SKS configuration
Edited by Jérémie Chabod