Commit 5eb363cf authored by Mike Gerdts's avatar Mike Gerdts Committed by Jim Harris
Browse files

bdev_ut: UB due to small buffer



bdev_multi_allocation tries to write four characters, an integer between
0 and INT_MAX, and a nul byte into 10 characters. That requires at least
15 characters.

This leads to build failures with "make CONFIG_DEBUG=n CONFIG_UBSAN=y".

Change-Id: I8cb9fd4ede31ae24809e4a04fd60a67dae3a0ac4
Signed-off-by: default avatarMike Gerdts <mgerdts@nvidia.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11261


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 7caa514f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4805,7 +4805,7 @@ static void
bdev_multi_allocation(void)
{
	const int max_bdev_num = 1024 * 16;
	char name[max_bdev_num][10];
	char name[max_bdev_num][16];
	char noexist_name[] = "invalid_bdev";
	struct spdk_bdev *bdev[max_bdev_num];
	int i, j;