From d809ccf79779a42a32d126ef1dabbaf53ebd233d Mon Sep 17 00:00:00 2001 From: MarcZX100 Date: Thu, 8 Oct 2026 00:32:53 +0000 Subject: [PATCH] test(libc): cover getcwd zero-size buffer --- core/libs/tests/GuestWorkingDirectory.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/core/libs/tests/GuestWorkingDirectory.cpp b/core/libs/tests/GuestWorkingDirectory.cpp index feeb9a9f4..28090a8a1 100644 --- a/core/libs/tests/GuestWorkingDirectory.cpp +++ b/core/libs/tests/GuestWorkingDirectory.cpp @@ -26,6 +26,7 @@ int main() { char tiny[] = "xyz"; Require(getcwd_nid_postfix(tiny, 2) == nullptr && *__error_nid_postfix() == 34); Require(std::strcmp(tiny, "xyz") == 0); + Require(getcwd_nid_postfix(path, 0) == nullptr && *__error_nid_postfix() == 22); char* allocated = getcwd_nid_postfix(nullptr, 0); Require(allocated && std::strcmp(allocated, path) == 0); GuestHeap::GuestHeapFree_nid_postfix(allocated);