diff options
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/utils.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/FICS/utils.c b/FICS/utils.c index 3d53afc..c23acac 100644 --- a/FICS/utils.c +++ b/FICS/utils.c @@ -202,23 +202,29 @@ PUBLIC int mail_file_to_user(int p, char *subj, char *fname) } -/* Process a command for a user */ -PUBLIC int pcommand(int p, char *comstr, ...) +/* + * Process a command for a user + */ +PUBLIC int +pcommand(int p, char *comstr, ...) { - char tmp[MAX_LINE_SIZE]; - int retval; - int current_socket = parray[p].socket; - va_list ap; - va_start(ap, comstr); - - vsprintf(tmp, comstr, ap); - retval = process_input(current_socket, tmp); - if (retval == COM_LOGOUT) { - process_disconnection(current_socket); - net_close_connection(current_socket); - } - va_end(ap); - return retval; + char tmp[MAX_LINE_SIZE]; + int current_socket = parray[p].socket; + int retval; + va_list ap; + + va_start(ap, comstr); + vsnprintf(tmp, sizeof tmp, comstr, ap); + va_end(ap); + + retval = process_input(current_socket, tmp); + + if (retval == COM_LOGOUT) { + process_disconnection(current_socket); + net_close_connection(current_socket); + } + + return retval; } PUBLIC int |