Skip to content

Commit cd92282

Browse files
authored
DAOS-15322 common: fix untrusted loop bound (#14014)
Addresses coverity issue where size is completely unbounded. This is no good way to really bound it but we can ensure it's not wholly unreasonable by checking against the size of the pool. Signed-off-by: Justin Zhang <[email protected]>
1 parent e2e43f2 commit cd92282

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/common/btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* (C) Copyright 2016-2023 Intel Corporation.
2+
* (C) Copyright 2016-2024 Intel Corporation.
33
*
44
* SPDX-License-Identifier: BSD-2-Clause-Patent
55
*/

src/vos/vos_tree.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* (C) Copyright 2016-2023 Intel Corporation.
2+
* (C) Copyright 2016-2024 Intel Corporation.
33
*
44
* SPDX-License-Identifier: BSD-2-Clause-Patent
55
*/
@@ -154,7 +154,9 @@ ktr_hkey_gen(struct btr_instance *tins, d_iov_t *key_iov, void *hkey)
154154
{
155155
struct ktr_hkey *kkey = (struct ktr_hkey *)hkey;
156156
struct umem_pool *umm_pool = tins->ti_umm.umm_pool;
157+
struct vos_pool *pool = (struct vos_pool *)tins->ti_priv;
157158

159+
D_ASSERT(key_iov->iov_len < pool->vp_pool_df->pd_scm_sz);
158160
hkey_common_gen(key_iov, hkey);
159161

160162
if (key_iov->iov_len > KH_INLINE_MAX)

0 commit comments

Comments
 (0)