net: lwm2m: Use the actual data size when provisioning PSK ID

"Public Key or Identity" resource is of opaque data type, therefore it's
not correct to assume it will be a NULL terminated string (the existing
servers, for instance Leshan, does not include NULL terminator). Use the
actual size associated with the resource instead.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2020-09-25 14:30:15 +02:00 committed by Jukka Rissanen
commit f35d88503a

View file

@ -4255,11 +4255,6 @@ static int load_tls_credential(struct lwm2m_ctx *client_ctx, uint16_t res_id,
return ret;
}
/* Set correct PSK_ID length */
if (type == TLS_CREDENTIAL_PSK_ID) {
cred_len = strlen(cred);
}
ret = tls_credential_add(client_ctx->tls_tag, type, cred, cred_len);
if (ret < 0) {
LOG_ERR("Error setting cred tag %d type %d: Error %d",