aboutsummaryrefslogtreecommitdiff
path: root/src/cli/stasis_indexer/website.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2026-06-02 17:04:13 -0400
committerGitHub <noreply@github.com>2026-06-02 17:04:13 -0400
commit252b9646c1cb0538123d51ced4a733f3dcfc266b (patch)
tree84b300af068db367bd9f3262487aeef3c7ba22d0 /src/cli/stasis_indexer/website.c
parentd8ee8c27444a56bb98dd8bd67a019a1e9efbcc10 (diff)
downloadstasis-252b9646c1cb0538123d51ced4a733f3dcfc266b.tar.gz
Safe strings, finally (#145)
* Add string copy and catonate replacements * safe_strncpy * safe_strncat * Replace string functions * gbo.ini: Update tweakwcs to 0.9.0 * generic.ini: Update tweakwcs to 0.9.0
Diffstat (limited to 'src/cli/stasis_indexer/website.c')
-rw-r--r--src/cli/stasis_indexer/website.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/cli/stasis_indexer/website.c b/src/cli/stasis_indexer/website.c
index 07ad6ad..edab735 100644
--- a/src/cli/stasis_indexer/website.c
+++ b/src/cli/stasis_indexer/website.c
@@ -35,9 +35,7 @@ int indexer_make_website(struct Delivery **ctx) {
}
// Replace *.md extension with *.html.
- strncpy(fullpath_dest, fullpath_src, sizeof(fullpath_dest) - 1);
- fullpath_dest[sizeof(fullpath_dest) - 1] = '\0';
-
+ safe_strncpy(fullpath_dest, fullpath_src, sizeof(fullpath_dest));
gen_file_extension_str(fullpath_dest, sizeof(fullpath_dest), ".html");
// Convert markdown to html
@@ -54,8 +52,7 @@ int indexer_make_website(struct Delivery **ctx) {
if (!strcmp(filename, "README.md")) {
char link_from[PATH_MAX] = {0};
char link_dest[PATH_MAX] = {0};
- strncpy(link_from, "README.html", sizeof(link_from) - 1);
- link_dest[sizeof(link_dest) - 1] = '\0';
+ safe_strncpy(link_from, "README.html", sizeof(link_from));
snprintf(link_dest, sizeof(link_dest), "%s/%s", root, "index.html");
if (symlink(link_from, link_dest)) {
SYSWARN("symlink(%s, %s) failed: %s", link_from, link_dest, strerror(errno));