Skip to content

Commit cb640a9

Browse files
committed
fix fenrir buffer size bug
1 parent b0e82af commit cb640a9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/wh_server_cert.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,13 +494,15 @@ int wh_Server_HandleCertRequest(whServerContext* server, uint16_t magic,
494494
/* Cache path: check metadata before reading cert data */
495495
whKeyId certId = wh_KeyId_TranslateFromClient(
496496
WH_KEYTYPE_WRAPPED, server->comm->client_id, req.id);
497+
uint32_t buf_capacity = cert_len;
497498
rc = wh_Server_KeystoreReadKey(server, certId, &meta, NULL,
498499
&cert_len);
499500
if (rc == WH_ERROR_OK) {
500501
if (meta.flags & WH_NVM_FLAGS_NONEXPORTABLE) {
501502
rc = WH_ERROR_ACCESS;
502503
}
503504
else {
505+
cert_len = buf_capacity;
504506
rc = wh_Server_KeystoreReadKey(
505507
server, certId, NULL, cert_data, &cert_len);
506508
if (rc == WH_ERROR_OK) {

0 commit comments

Comments
 (0)