Skip to content

Fix certificate count error handling in TLS accept - #629

Open
Roytak wants to merge 1 commit into
develfrom
issue627-tls-cert-count
Open

Fix certificate count error handling in TLS accept#629
Roytak wants to merge 1 commit into
develfrom
issue627-tls-cert-count

Conversation

@Roytak

@Roytak Roytak commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

nc_server_tls_get_num_certs() was declared to return uint32_t but returned -1 when a truststore reference could not be resolved. The error became UINT32_MAX and passed the "neither CA nor end-entity certificates configured" check, which could not fire anyway (an unsigned value compared with <= 0). With a referenced endpoint the two counts were added, so the wrapped value could even come out small.

Return the count through an output parameter and the error through the return value.

nc_server_tls_get_num_certs() was declared to return uint32_t but
returned -1 when resolving a truststore reference failed. The error
became UINT32_MAX, which then passed the "neither CA nor end-entity
certificates configured" check in nc_accept_tls_session() (a check
that could never fire anyway, comparing an unsigned value with <= 0).
With a referenced endpoint the two counts were added, so the wrapped
value could even come out as a small number.

Return the count through an output parameter and the error through
the return value instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant