Fix text replacement warning

Using strncpy to cut off copying a terminating NUL yields a gcc
warning.  Just use memcpy instead.
This commit is contained in:
Dean Luick
2021-01-17 14:12:58 -06:00
parent 5dc5ece412
commit f63d435c6d
4 changed files with 5 additions and 5 deletions

View File

@@ -1382,8 +1382,8 @@ int final;
else if ((HClairvoyant || EClairvoyant) && BClairvoyant) {
Strcpy(buf, from_what(-CLAIRVOYANT));
if (!strncmp(buf, " because of ", 12))
/* overwrite substring; strncpy doesn't add terminator */
(void) strncpy(buf, " if not for ", 12);
/* overwrite substring */
memcpy(buf, " if not for ", 12);
enl_msg(You_, "could be", "could have been", " clairvoyant", buf);
}
if (Infravision)