From 30120d044c91980cc77d4ad1021f02bf3b356d7c Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Mon, 1 Jan 2024 21:38:25 +0100 Subject: Reformatted com_handles() and replaced sprintf() with snprintf() --- FICS/comproc.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'FICS') diff --git a/FICS/comproc.c b/FICS/comproc.c index 2c794a3..f76adc1 100644 --- a/FICS/comproc.c +++ b/FICS/comproc.c @@ -1701,18 +1701,21 @@ com_mailhelp(int p, param_list param) return COM_OK; } -PUBLIC int com_handles(int p, param_list param) +PUBLIC int +com_handles(int p, param_list param) { - char *buffer[1000]; - char pdir[MAX_FILENAME_SIZE]; - int count; - - sprintf(pdir, "%s/%c", player_dir, param[0].val.word[0]); - count = search_directory(pdir, param[0].val.word, buffer, 1000); - pprintf(p, "Found %d names.\n", count); - if (count > 0) - display_directory(p, buffer, count); - return COM_OK; + char *buffer[1000]; + char pdir[MAX_FILENAME_SIZE]; + int count; + + snprintf(pdir, sizeof pdir, "%s/%c", player_dir, param[0].val.word[0]); + count = search_directory(pdir, param[0].val.word, buffer, 1000); + pprintf(p, "Found %d names.\n", count); + + if (count > 0) + display_directory(p, buffer, count); + + return COM_OK; } PUBLIC int -- cgit v1.2.3