Skip to content

Commit

Permalink
refix format string
Browse files Browse the repository at this point in the history
Found by: michaelortmann
Patch by: michaelortmann
  • Loading branch information
michaelortmann committed Feb 18, 2024
1 parent 5aabf4d commit 1c5ea70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/botmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ int add_note(char *to, char *from, char *msg, int idx, int echo)
{
#define FROMLEN 40
int status, i, iaway, sock;
char *p, botf[FROMLEN + 1 + HANDLEN + 1], ss[81], ssf[81];
char *p, botf[FROMLEN + 1 + HANDLEN + 1], ss[81], ssf[20 + 1 + sizeof botf];
struct userrec *u;

/* Notes have a length limit. Note + PRIVMSG header + nick + date must
Expand Down Expand Up @@ -786,7 +786,7 @@ int add_note(char *to, char *from, char *msg, int idx, int echo)
if (strchr(from, '@')) {
strcpy(botf, from);
} else
sprintf(botf, "%s@%s", from, botnetnick);
snprintf(botf, sizeof botf, "%s@%s", from, botnetnick);

} else
strcpy(botf, botnetnick);
Expand All @@ -803,7 +803,7 @@ int add_note(char *to, char *from, char *msg, int idx, int echo)
dprintf(idx, "-> %s@%s: %s\n", x, p, msg);

if (idx >= 0) {
sprintf(ssf, "%lu:%s", dcc[idx].sock, botf);
snprintf(ssf, sizeof ssf, "%lu:%s", dcc[idx].sock, botf);
botnet_send_priv(i, ssf, x, p, "%s", msg);
} else
botnet_send_priv(i, botf, x, p, "%s", msg);
Expand Down

0 comments on commit 1c5ea70

Please sign in to comment.