From c7e6e5ea086ff3ea5df67f600bfd9b7241dbd0a2 Mon Sep 17 00:00:00 2001 From: Tim Cava Date: Mon, 11 Nov 2013 21:28:03 +0000 Subject: [PATCH] Convert sprintf calls to snprintf. From pvaldes. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@448 13b04d17-f746-0410-82c6-800466cd88b0 --- source/funny.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/funny.c b/source/funny.c index 6f42c30..0ced795 100644 --- a/source/funny.c +++ b/source/funny.c @@ -110,7 +110,7 @@ void funny_print_widelist(void) *buffer1 = '\0'; for (i = 1; i < wl_elements; i++) { - sprintf(buffer2, "%s(%d) ", wide_list[i]->channel, + snprintf(buffer2, sizeof buffer2, "%s(%d) ", wide_list[i]->channel, wide_list[i]->users); ptr = strchr(buffer1, '\0'); if (strlen(buffer1) + strlen(buffer2) > current_term->TI_cols - 5) @@ -149,11 +149,11 @@ void funny_list(char *from, char **ArgList) if (last_width != get_int_var(CHANNEL_NAME_WIDTH_VAR)) { if ((last_width = get_int_var(CHANNEL_NAME_WIDTH_VAR)) != 0) - snprintf(format, 25, "%%s %%-%u.%us %%-5s %%s", /*thing_ansi,*/ + snprintf(format, sizeof format, "%%s %%-%u.%us %%-5s %%s", /*thing_ansi,*/ (unsigned char) last_width, (unsigned char) last_width); else - snprintf(format, 25, "%%s %%s %%-5s %%s"/*, thing_ansi*/); + snprintf(format, sizeof format, "%%s %%s %%-5s %%s"/*, thing_ansi*/); } channel = ArgList[0]; user_cnt = ArgList[1]; @@ -333,7 +333,7 @@ int user_count = 0; if (last_width != get_int_var(CHANNEL_NAME_WIDTH_VAR)) { if ((last_width = get_int_var(CHANNEL_NAME_WIDTH_VAR)) != 0) - sprintf(format, "%%s: %%-%u.%us %%s", + snprintf(format, sizeof format, "%%s: %%-%u.%us %%s", (unsigned char) last_width, (unsigned char) last_width); else