use strncat(sizeof(...) - strlen(...) - 1)

This commit is contained in:
Mackerel
2022-09-03 00:11:03 -04:00
parent 95d4da4972
commit 2d8c05b4ed
2 changed files with 2 additions and 2 deletions

View File

@@ -268,7 +268,7 @@ void create_world_index(int znum, const char *type)
while (get_line(oldfile, buf)) {
if (*buf == '$') {
/* The following used to add a blank line, thanks to Brian Taylor for the fix. */
fprintf(newfile, "%s", (!found ? strncat(buf1, "\n$\n", sizeof(buf1)-1) : "$\n"));
fprintf(newfile, "%s", (!found ? strncat(buf1, "\n$\n", sizeof(buf1) - strlen(buf1) - 1) : "$\n"));
break;
} else if (!found) {
sscanf(buf, "%d", &num);