diff --git a/src/pager.c b/src/pager.c index 15ba394d7..253f9f9b5 100644 --- a/src/pager.c +++ b/src/pager.c @@ -656,7 +656,7 @@ char *supplemental_name; (note: strncpy() only terminates output string if the specified count is bigger than the length of the substring being copied) */ if (!strncmp(dbase_str, "moist towel", 11)) - (void) strncpy(dbase_str += 2, "wet", 3); /* skip "mo" replace "ist" */ + memcpy(dbase_str += 2, "wet", 3); /* skip "mo" replace "ist" */ /* Make sure the name is non-empty. */ if (*dbase_str) { diff --git a/src/pline.c b/src/pline.c index fbfa5fa73..f792ce765 100644 --- a/src/pline.c +++ b/src/pline.c @@ -161,7 +161,7 @@ VA_DECL(const char *, line) /* truncate, preserving the final 3 characters: "___ extremely long text" -> "___ extremely l...ext" (this may be suboptimal if overflow is less than 3) */ - (void) strncpy(pbuf + BUFSZ - 1 - 6, "...", 3); + memcpy(pbuf + BUFSZ - 1 - 6, "...", 3); /* avoid strncpy; buffers could overlap if excess is small */ pbuf[BUFSZ - 1 - 3] = line[ln - 3]; pbuf[BUFSZ - 1 - 2] = line[ln - 2]; diff --git a/src/write.c b/src/write.c index 512d3388a..0dae6127c 100644 --- a/src/write.c +++ b/src/write.c @@ -158,7 +158,7 @@ register struct obj *pen; nm += 3; if ((bp = strstri(nm, " armour")) != 0) { - (void) strncpy(bp, " armor ", 7); /* won't add '\0' */ + memcpy(bp, " armor ", 7); /* won't add '\0' */ (void) mungspaces(bp + 1); /* remove the extra space */ }