Fixed some sprintf calls

This commit is contained in:
Michiel Broek 2006-02-23 21:37:04 +00:00
parent 0651057b66
commit edc2dca188
3 changed files with 6 additions and 6 deletions

View File

@ -304,7 +304,7 @@ int part(pid_t pid, char *reason)
chat_msg(tmpu->channel, NULL, buf); chat_msg(tmpu->channel, NULL, buf);
if (strcasecmp(tmp->name, (char *)"#sysop")) { if (strcasecmp(tmp->name, (char *)"#sysop")) {
if (reason && strlen(reason)) { if (reason && strlen(reason)) {
sprintf(buf, "%s %s", tmp->name, reason); snprintf(buf, 81, "%s %s", tmp->name, reason);
send_at((char *)"PART", tmpu->nick, buf); send_at((char *)"PART", tmpu->nick, buf);
} else { } else {
send_at((char *)"PART", tmpu->nick, tmp->name); send_at((char *)"PART", tmpu->nick, tmp->name);

View File

@ -567,7 +567,7 @@ void send_at(char *cmd, char *nick, char *param)
for (tnsl = ncsl; tnsl; tnsl = tnsl->next) { for (tnsl = ncsl; tnsl; tnsl = tnsl->next) {
if (tnsl->state == NCS_CONNECT) { if (tnsl->state == NCS_CONNECT) {
sprintf(buf, "%s %s@%s %s\r\n", cmd, nick, tnsl->myname, param); snprintf(buf, 512, "%s %s@%s %s\r\n", cmd, nick, tnsl->myname, param);
send_msg(tnsl, buf); send_msg(tnsl, buf);
} }
} }
@ -582,7 +582,7 @@ void send_nick(char *nick, char *name, char *realname)
for (tnsl = ncsl; tnsl; tnsl = tnsl->next) { for (tnsl = ncsl; tnsl; tnsl = tnsl->next) {
if (tnsl->state == NCS_CONNECT) { if (tnsl->state == NCS_CONNECT) {
sprintf(buf, "NICK %s %s %s %s\r\n", nick, name, tnsl->myname, realname); snprintf(buf, 512, "NICK %s %s %s %s\r\n", nick, name, tnsl->myname, realname);
send_msg(tnsl, buf); send_msg(tnsl, buf);
} }
} }

View File

@ -54,7 +54,7 @@ int main(int argc, char **argv)
bwname = xstrcpy(argv[1]); bwname = xstrcpy(argv[1]);
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s.INF", bwname); snprintf(temp, PATH_MAX, "%s.INF", bwname);
if ((fp = fopen(temp, "r"))) { if ((fp = fopen(temp, "r"))) {
printf("---- %s.INF -------------------------------------------------------\n", bwname); printf("---- %s.INF -------------------------------------------------------\n", bwname);
@ -141,7 +141,7 @@ int main(int argc, char **argv)
fclose(fp); fclose(fp);
} }
sprintf(temp, "%s.MIX", bwname); snprintf(temp, PATH_MAX, "%s.MIX", bwname);
if ((fp = fopen(temp, "r"))) { if ((fp = fopen(temp, "r"))) {
printf("---- %s.MIX -------------------------------------------------------\n\n", bwname); printf("---- %s.MIX -------------------------------------------------------\n\n", bwname);
printf(" Area Total Pers. FTI ptr\n"); printf(" Area Total Pers. FTI ptr\n");
@ -153,7 +153,7 @@ int main(int argc, char **argv)
fclose(fp); fclose(fp);
} }
sprintf(temp, "%s.FTI", bwname); snprintf(temp, PATH_MAX, "%s.FTI", bwname);
pos = 0; pos = 0;
if ((fp = fopen(temp, "r"))) { if ((fp = fopen(temp, "r"))) {
printf("---- %s.FTI -------------------------------------------------------\n\n", bwname); printf("---- %s.FTI -------------------------------------------------------\n\n", bwname);