From 08480564879ef4d867163ff33d86b8d1b71cc8c9 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 4 Sep 2023 10:10:03 +0200 Subject: [PATCH] string: fix strnlen parameter validation assert Signed-off-by: Simon Rozman --- include/stdex/string.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/stdex/string.hpp b/include/stdex/string.hpp index ad82ba336..ec2d9790b 100644 --- a/include/stdex/string.hpp +++ b/include/stdex/string.hpp @@ -206,7 +206,7 @@ namespace stdex template inline size_t strnlen(_In_reads_or_z_opt_(count) const T* str, _In_ size_t count) { - assert(str); + assert(str || !count); size_t i; for (i = 0; i < count && str[i]; ++i); return i;