aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-29 01:51:34 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-29 01:51:34 +0100
commit2279ab922829a58a4361eac874f78a899424c813 (patch)
treeba8768c3fe190eb8699d82bfc4d4f9a9509f7dc3
parent2b5fd7eaa50de964fb87d22f374543da6147ac38 (diff)
Replaced strcpy() with strlcpy()
-rw-r--r--FICS/makerank.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/FICS/makerank.c b/FICS/makerank.c
index 01f95c5..dcac856 100644
--- a/FICS/makerank.c
+++ b/FICS/makerank.c
@@ -1,4 +1,6 @@
-/* Revised by maxxe 23/12/14 */
+/*
+ * Revised by maxxe 23/12/14
+ */
#include <ctype.h>
#include <err.h>
@@ -6,6 +8,10 @@
#include <stdlib.h>
#include <string.h>
+#if __linux__
+#include <bsd/string.h>
+#endif
+
#include "makerank.h"
static ENTRY **list;
@@ -72,8 +78,11 @@ GetPlayerInfo(char *fileName, ENTRY *e)
printf("TROUBLE: %s's handle is "
"listed as %s.\n", e->name,
NameWithCase);
- } else
- strcpy(e->name, NameWithCase);
+ } else if (strlcpy(e->name, NameWithCase,
+ sizeof e->name) >= sizeof e->name) {
+ fprintf(stderr, "%s: warning: "
+ "strlcpy() truncated\n", __func__);
+ }
} else if (!strcmp(field, "S_NUM:")) {
sscanf(line, "%*s %d", &(e->r[0].num));
} else if (!strcmp(field, "B_NUM:")) {