Skip to content

Commit

Permalink
fixup! examples/dtls-sock: cleanup credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrolanzieri committed Feb 1, 2024
1 parent 6468b28 commit 30a9e0e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/dtls-sock/dtls-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ static credman_tag_t _client_psk_cb(sock_dtls_t *sock, sock_udp_ep_t *ep, credma
if (hint && hint_len) {
printf("Client got hint: %.*s\n", (unsigned)hint_len, hint);

if (!memcmp(hint, psk_id_0_hint, sizeof(psk_id_0_hint) - 1)) {
if (hint_len == sizeof(psk_id_0_hint) &&
!memcmp(hint, psk_id_0_hint, sizeof(psk_id_0_hint) - 1)) {
return SOCK_DTLS_CLIENT_TAG_0;
}

if (!memcmp(hint, psk_id_1_hint, sizeof(psk_id_1_hint) - 1)) {
if (hint_len == sizeof(psk_id_1_hint) &&
!memcmp(hint, psk_id_1_hint, sizeof(psk_id_1_hint) - 1)) {
return SOCK_DTLS_CLIENT_TAG_1;
}
}
Expand Down

0 comments on commit 30a9e0e

Please sign in to comment.