diff options
| author | Benjamin Linskey | 2026-06-11 05:47:35 -0400 |
|---|---|---|
| committer | Benjamin Linskey | 2026-06-11 05:47:35 -0400 |
| commit | 55c0be03a23d3fca4994d4d28018e0826c34fa08 (patch) | |
| tree | 1736ca24700fc9aff8e4e4f254317a91fe5ec0e0 | |
| parent | 6bc476786626f214c9bca89f3114792d03bb16fd (diff) | |
| download | rogue-55c0be03a23d3fca4994d4d28018e0826c34fa08.tar.gz | |
Replace strcpy() and strcat() with safer functions
Switched to strlcpy() and strlcat(). Fixes a compiler warning on OpenBSD.
| -rw-r--r-- | room.c | 3 | ||||
| -rw-r--r-- | save.c | 4 |
2 files changed, 4 insertions, 3 deletions
@@ -601,7 +601,8 @@ CH: * allocated to hold MAX_OPT_LEN+2 * bytes. This is arranged in init.c. */ - (void)strcpy(*(options[i].strval), buf); + char *dst = *(options[i].strval); + (void)strlcpy(dst, buf, sizeof(dst)); } opt_show(i); goto CH; @@ -106,8 +106,8 @@ save_into_file(const char *sfile) "out of memory for save file name"); sfile = error_file; } else { - (void)strcpy(name_buffer, hptr); - (void)strcat(name_buffer, sfile+1); + (void)strlcpy(name_buffer, hptr, sizeof(name_buffer)); + (void)strlcat(name_buffer, sfile+1, sizeof(name_buffer)); sfile = name_buffer; } /* |