aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-04-25 00:23:54 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-04-25 00:23:54 -0400
commit5e583af9c55a5bdda6d0f699117a9df163f00b21 (patch)
tree9a4c597180f6398dd064624c3bd5c432c2f8c285 /src/lib
parentec2577ca0875f97a6a89d847b5ac9524f947c79d (diff)
downloadstasis-5e583af9c55a5bdda6d0f699117a9df163f00b21.tar.gz
Use strncpy in example code
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/core/relocation.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/core/relocation.c b/src/lib/core/relocation.c
index f7dafe8..16376b3 100644
--- a/src/lib/core/relocation.c
+++ b/src/lib/core/relocation.c
@@ -8,8 +8,9 @@
* Replace all occurrences of `target` with `replacement` in `original`
*
* ~~~{.c}
- * char *str = calloc(100, sizeof(char));
- * strcpy(str, "This are a test.");
+ * size_t str_maxlen = 100;
+ * char *str = calloc(str_maxlen, sizeof(char));
+ * strncpy(str, "This are a test.", str_maxlen - 1);
* if (replace_text(str, "are", "is")) {
* fprintf(stderr, "string replacement failed\n");
* exit(1);