Convert sprintf calls to snprintf. From pvaldes.

git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@458 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Tim Cava
2013-11-11 21:29:11 +00:00
parent 4f5aab355b
commit f69404b0f9

View File

@@ -230,7 +230,7 @@ void prepare_addshit(UserhostItem *stuff, char *nick, char *args)
uh = clear_server_flags(stuff->user); uh = clear_server_flags(stuff->user);
while (strlen(uh) > 7) uh++; while (strlen(uh) > 7) uh++;
sprintf(listbuf, "*%s@%s", uh, stuff->host); snprintf(listbuf, sizeof listbuf, "*%s@%s", uh, stuff->host);
add_to_a_list(listbuf, thetype, "*", channels, reason, shit); add_to_a_list(listbuf, thetype, "*", channels, reason, shit);
} }
@@ -653,7 +653,7 @@ char *check;
for (nick = next_nicklist(chan, NULL); nick; nick = next_nicklist(chan, nick)) for (nick = next_nicklist(chan, NULL); nick; nick = next_nicklist(chan, nick))
{ {
check = clear_server_flags(nick->host); check = clear_server_flags(nick->host);
sprintf(tmp, "%s!%s", nick->nick, check); snprintf(tmp, sizeof tmp, "%s!%s", nick->nick, check);
if (wild_match(added->filter, tmp)) if (wild_match(added->filter, tmp))
{ {
if (type) if (type)
@@ -863,7 +863,7 @@ register ShitList *thisptr = shitlist_list;
if (!uh || !niq) if (!uh || !niq)
return NULL; return NULL;
u = clear_server_flags(uh); u = clear_server_flags(uh);
sprintf(theuh, "%s!%s", niq, u); snprintf(theuh, sizeof theuh, "%s!%s", niq, u);
while (thisptr) while (thisptr)
{ {
if (!strcmp(thisptr->filter, theuh) || (/*wild_match(theuh, thisptr->filter) || */wild_match(thisptr->filter, theuh))) if (!strcmp(thisptr->filter, theuh) || (/*wild_match(theuh, thisptr->filter) || */wild_match(thisptr->filter, theuh)))
@@ -1568,7 +1568,7 @@ BUILT_IN_COMMAND(savelists)
int size = -1; int size = -1;
sprintf(thefile, "%s/%s.sav", get_string_var(CTOOLZ_DIR_VAR), version); snprintf(thefile, sizeof thefile, "%s/%s.sav", get_string_var(CTOOLZ_DIR_VAR), version);
if ((p = expand_twiddle(thefile))) if ((p = expand_twiddle(thefile)))
outfile = fopen(p, "w"); outfile = fopen(p, "w");