aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);