diff --git a/CHANGELOG.md b/CHANGELOG.md index e80b46f..c52e88f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,16 @@ and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0. ## [Unreleased] +## v0.5.38 — 2026-07-26 + +### Fixed +- **[P0] realpath buffer too small in cmd_init** — replaced `char resolved[512]` with + `realpath(dir, NULL)` (dynamic allocation) to fix glibc `_FORTIFY_SOURCE=2` abort on + ubuntu-22.04. `__realpath_chk` requires the destination buffer to be at least `PATH_MAX` + (4096 bytes); the 512-byte stack buffer triggered `*** buffer overflow detected ***` + during `cfusa init --docs --dir ` (test_init_docs_generates_templates), aborting + all remaining CLI tests in the Release CI build. + ## v0.5.37 — 2026-07-26 ### Fixed diff --git a/cmd/cfusa/cmd_init.c b/cmd/cfusa/cmd_init.c index 1f75daa..1558ced 100644 --- a/cmd/cfusa/cmd_init.c +++ b/cmd/cfusa/cmd_init.c @@ -1,3 +1,6 @@ +#if defined(__linux__) || defined(__unix__) +# define _GNU_SOURCE +#endif #include #include #include @@ -59,11 +62,12 @@ int cmd_init(int argc, char **argv) char dir_basename[256] = "project"; if (!project) { const char *abs = dir; - char resolved[512]; - if (realpath(dir, resolved)) abs = resolved; + char *resolved = realpath(dir, NULL); + if (resolved) abs = resolved; const char *slash = strrchr(abs, '/'); strncpy(dir_basename, slash ? slash + 1 : abs, sizeof(dir_basename) - 1); project = dir_basename; + free(resolved); } cfusa_config_t cfg; diff --git a/include/cfusa/version.h b/include/cfusa/version.h index c2dfac4..35f2352 100644 --- a/include/cfusa/version.h +++ b/include/cfusa/version.h @@ -3,8 +3,8 @@ #define CFUSA_VERSION_MAJOR 0 #define CFUSA_VERSION_MINOR 5 -#define CFUSA_VERSION_PATCH 36 -#define CFUSA_VERSION_STRING "0.5.37" +#define CFUSA_VERSION_PATCH 38 +#define CFUSA_VERSION_STRING "0.5.38" #define CFUSA_SCHEMA_VERSION "1.10.4" #define CFUSA_SPEC_VERSION "1.10.4"