fix(test): size mkdtemp templates for the Windows %TEMP% expansion

cbm_mkdtemp copies the expanded path back into the caller's template;
on Windows that is %TEMP%\..., far longer than the literal. The two
literal-sized arrays (symbol-history, why) were stack overflows there —
caught by the real-Windows leg as an fopen failure. CBM_SZ_256 buffers,
like every other call site.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This commit is contained in:
Martin Vogel
2026-08-27 20:48:13 +02:00
parent 136685f1a5
commit 409dce4d81
+6 -2
View File
@@ -1872,7 +1872,10 @@ TEST(atlas_symbol_history_log_l_and_remote) {
#endif
PASS(); /* no git in this environment; the guarded paths above ran */
char tmpl[] = "/tmp/cbm_hist_XXXXXX";
/* cbm_mkdtemp rewrites /tmp/… to %TEMP%\… on Windows and copies the
* expanded path back — the template buffer must hold it (CBM_SZ_256
* convention; a literal-sized array is a stack overflow there). */
char tmpl[256] = "/tmp/cbm_hist_XXXXXX";
char *root = cbm_mkdtemp(tmpl);
ASSERT_NOT_NULL(root);
char dir[1024];
@@ -1920,7 +1923,8 @@ TEST(atlas_symbol_history_log_l_and_remote) {
}
TEST(atlas_why_extracts_guard_chains) {
char tmpl[] = "/tmp/cbm_why_XXXXXX";
/* Same CBM_SZ_256 convention: the Windows expansion must fit. */
char tmpl[256] = "/tmp/cbm_why_XXXXXX";
char *root = cbm_mkdtemp(tmpl);
ASSERT_NOT_NULL(root);
char dir[1024];