projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
07ba2ef
)
- pass -Wcast-qual to gcc
author
Nathan Bryant
<loanshark@uncensored.citadel.org>
Tue, 12 Mar 2002 01:33:42 +0000
(
01:33
+0000)
committer
Nathan Bryant
<loanshark@uncensored.citadel.org>
Tue, 12 Mar 2002 01:33:42 +0000
(
01:33
+0000)
- more sprintf bashing
19 files changed:
citadel/ChangeLog
patch
|
blob
|
history
citadel/configure.ac
patch
|
blob
|
history
citadel/internet_addressing.c
patch
|
blob
|
history
citadel/internet_addressing.h
patch
|
blob
|
history
citadel/locate_host.c
patch
|
blob
|
history
citadel/messages.c
patch
|
blob
|
history
citadel/routines.c
patch
|
blob
|
history
citadel/routines.h
patch
|
blob
|
history
citadel/routines2.c
patch
|
blob
|
history
citadel/sendcommand.c
patch
|
blob
|
history
citadel/serv_bio.c
patch
|
blob
|
history
citadel/serv_expire.c
patch
|
blob
|
history
citadel/serv_imap.c
patch
|
blob
|
history
citadel/serv_network.c
patch
|
blob
|
history
citadel/serv_pop3.c
patch
|
blob
|
history
citadel/serv_smtp.c
patch
|
blob
|
history
citadel/server_main.c
patch
|
blob
|
history
citadel/tools.c
patch
|
blob
|
history
citadel/tools.h
patch
|
blob
|
history
diff --git
a/citadel/ChangeLog
b/citadel/ChangeLog
index 5b1627b96e305582233cb39ba645831218ee8830..114dc091d1d72780b666307c31be85a37b14b922 100644
(file)
--- a/
citadel/ChangeLog
+++ b/
citadel/ChangeLog
@@
-1,4
+1,8
@@
$Log$
$Log$
+ Revision 590.140 2002/03/12 01:33:42 nbryant
+ - pass -Wcast-qual to gcc
+ - more sprintf bashing
+
Revision 590.139 2002/03/12 00:03:43 nbryant
more sprintf removals
Revision 590.139 2002/03/12 00:03:43 nbryant
more sprintf removals
@@
-3437,3
+3441,4
@@
Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
diff --git
a/citadel/configure.ac
b/citadel/configure.ac
index 7b3452b21c8c84118a0bcbcc2aa62cf7f7647dbb..14083d78afc052fbb6e96d5387f6be51023b11a1 100644
(file)
--- a/
citadel/configure.ac
+++ b/
citadel/configure.ac
@@
-100,10
+100,10
@@
dnl Set up system-dependent compiler flags.
if test "$GCC" = yes; then
case "$host" in
*-*-solaris*|alpha*-dec-osf*)
if test "$GCC" = yes; then
case "$host" in
*-*-solaris*|alpha*-dec-osf*)
- CFLAGS="$CFLAGS -Wall -Wcast-align -Wno-char-subscripts"
+ CFLAGS="$CFLAGS -Wall -Wcast-
qual -Wcast-
align -Wno-char-subscripts"
;;
*)
;;
*)
- CFLAGS="$CFLAGS -Wall -Wcast-align -Wstrict-prototypes"
+ CFLAGS="$CFLAGS -Wall -Wcast-
qual -Wcast-
align -Wstrict-prototypes"
;;
esac
fi
;;
esac
fi
diff --git
a/citadel/internet_addressing.c
b/citadel/internet_addressing.c
index 741c563fe5ae9196ecd069e2e58580b69fc74a3f..93337b3b166fa006461fdd179f5d62fa1bd6198e 100644
(file)
--- a/
citadel/internet_addressing.c
+++ b/
citadel/internet_addressing.c
@@
-157,7
+157,7
@@
void unfold_rfc822_field(char *field) {
* Split an RFC822-style address into userid, host, and full name
*
*/
* Split an RFC822-style address into userid, host, and full name
*
*/
-void process_rfc822_addr(char *rfc822, char *user, char *node, char *name)
+void process_rfc822_addr(c
onst c
har *rfc822, char *user, char *node, char *name)
{
int a;
{
int a;
diff --git
a/citadel/internet_addressing.h
b/citadel/internet_addressing.h
index d873b972dd5bf738c6192ff63b27f761d3a10316..42b7c5bd11ef40100d3897816ec3cc3d2474dad7 100644
(file)
--- a/
citadel/internet_addressing.h
+++ b/
citadel/internet_addressing.h
@@
-14,7
+14,7
@@
struct internet_address_list {
int fuzzy_match(struct usersupp *us, char *matchstring);
int fuzzy_match(struct usersupp *us, char *matchstring);
-void process_rfc822_addr(char *rfc822, char *user, char *node, char *name);
+void process_rfc822_addr(c
onst c
har *rfc822, char *user, char *node, char *name);
char *rfc822_fetch_field(char *rfc822, char *fieldname);
int IsDirectory(char *addr);
char *rfc822_fetch_field(char *rfc822, char *fieldname);
int IsDirectory(char *addr);
diff --git
a/citadel/locate_host.c
b/citadel/locate_host.c
index f7878684352db5ced117d24a5ce664de8d461e7d..7e30b46f2aea6732dc06b88b44812ef6a38ce889 100644
(file)
--- a/
citadel/locate_host.c
+++ b/
citadel/locate_host.c
@@
-31,7
+31,8
@@
void locate_host(char *tbuf, size_t n, const struct in_addr *addr)
{
struct hostent *ch;
void locate_host(char *tbuf, size_t n, const struct in_addr *addr)
{
struct hostent *ch;
- char *i;
+ const char *i;
+ char *j;
int a1, a2, a3, a4;
lprintf(9, "locate_host() called\n");
int a1, a2, a3, a4;
lprintf(9, "locate_host() called\n");
@@
-40,10
+41,10
@@
void locate_host(char *tbuf, size_t n, const struct in_addr *addr)
begin_critical_section(S_NETDB);
#endif
begin_critical_section(S_NETDB);
#endif
- if ((ch = gethostbyaddr((char *) addr, sizeof(*addr), AF_INET)) ==
+ if ((ch = gethostbyaddr((c
onst c
har *) addr, sizeof(*addr), AF_INET)) ==
NULL) {
bad_dns:
NULL) {
bad_dns:
- i = (char *) addr;
+ i = (c
onst c
har *) addr;
a1 = ((*i++) & 0xff);
a2 = ((*i++) & 0xff);
a3 = ((*i++) & 0xff);
a1 = ((*i++) & 0xff);
a2 = ((*i++) & 0xff);
a3 = ((*i++) & 0xff);
@@
-53,9
+54,9
@@
void locate_host(char *tbuf, size_t n, const struct in_addr *addr)
section */
}
/* check if the forward DNS agrees; if not, they're spoofing */
section */
}
/* check if the forward DNS agrees; if not, they're spoofing */
-
i
= strdoop(ch->h_name);
- ch = gethostbyname(
i
);
- phree(
i
);
+
j
= strdoop(ch->h_name);
+ ch = gethostbyname(
j
);
+ phree(
j
);
if (ch == NULL)
goto bad_dns;
if (ch == NULL)
goto bad_dns;
diff --git
a/citadel/messages.c
b/citadel/messages.c
index 8da83b3cc64f28003a4d3caab6cd7011b68059fe..1a4e6308b93ae518a961b2ceddbcf6b707126fa1 100644
(file)
--- a/
citadel/messages.c
+++ b/
citadel/messages.c
@@
-50,7
+50,7
@@
struct cittext {
};
void sttybbs(int cmd);
};
void sttybbs(int cmd);
-int haschar(char *st, int ch);
+int haschar(c
onst c
har *st, int ch);
int checkpagin(int lp, int pagin, int height);
void getline(char *string, int lim);
void formout(char *name);
int checkpagin(int lp, int pagin, int height);
void getline(char *string, int lim);
void formout(char *name);
diff --git
a/citadel/routines.c
b/citadel/routines.c
index 55e8f94d28d0f9f56a2e6741669ad6efbe560c6e..c3c9f65743bbd8fe9f0619e1dd9852b2dbe6757f 100644
(file)
--- a/
citadel/routines.c
+++ b/
citadel/routines.c
@@
-122,14
+122,14
@@
void edituser(void)
int newnow = 0;
newprompt("User name: ",who,25);
int newnow = 0;
newprompt("User name: ",who,25);
-AGUP: s
printf(buf,
"AGUP %s",who);
+AGUP: s
nprintf(buf, sizeof buf,
"AGUP %s",who);
serv_puts(buf);
serv_gets(buf);
if (buf[0]!='2') {
scr_printf("%s\n",&buf[4]);
scr_printf("Do you want to create this user? ");
if (yesno()) {
serv_puts(buf);
serv_gets(buf);
if (buf[0]!='2') {
scr_printf("%s\n",&buf[4]);
scr_printf("Do you want to create this user? ");
if (yesno()) {
- s
printf(
buf, "CREU %s", who);
+ s
nprintf(buf, sizeof
buf, "CREU %s", who);
serv_puts(buf);
serv_gets(buf);
if (buf[0] == '2') {
serv_puts(buf);
serv_gets(buf);
if (buf[0] == '2') {
@@
-171,7
+171,7
@@
AGUP: sprintf(buf,"AGUP %s",who);
userpurge = intprompt("Purge time (in days, 0 for system default",
userpurge, 0, INT_MAX);
userpurge = intprompt("Purge time (in days, 0 for system default",
userpurge, 0, INT_MAX);
- s
printf(
buf, "ASUP %s|%s|%d|%d|%d|%d|%ld|%ld|%d",
+ s
nprintf(buf, sizeof
buf, "ASUP %s|%s|%d|%d|%d|%d|%ld|%ld|%d",
who, pass, flags, timescalled, posted, axlevel, usernum,
(long)lastcall, userpurge);
serv_puts(buf);
who, pass, flags, timescalled, posted, axlevel, usernum,
(long)lastcall, userpurge);
serv_puts(buf);
@@
-213,7
+213,7
@@
void enter_config(int mode)
int width, height, flags, filter;
char buf[128];
int width, height, flags, filter;
char buf[128];
- s
printf(buf,
"GETU");
+ s
nprintf(buf, sizeof buf,
"GETU");
serv_puts(buf);
serv_gets(buf);
if (buf[0]!='2') {
serv_puts(buf);
serv_gets(buf);
if (buf[0]!='2') {
@@
-283,7
+283,7
@@
void enter_config(int mode)
}
}
}
}
- s
printf(buf,
"SETU %d|%d|%d|%d",width,height,flags,filter);
+ s
nprintf(buf, sizeof buf,
"SETU %d|%d|%d|%d",width,height,flags,filter);
serv_puts(buf);
serv_gets(buf);
if (buf[0]!='2') scr_printf("%s\n",&buf[4]);
serv_puts(buf);
serv_gets(buf);
if (buf[0]!='2') scr_printf("%s\n",&buf[4]);
@@
-380,7
+380,7
@@
char *strerror(int e)
{
static char buf[128];
{
static char buf[128];
- s
printf(buf,
"errno = %d",e);
+ s
nprintf(buf, sizeof buf,
"errno = %d",e);
return(buf);
}
#endif
return(buf);
}
#endif
@@
-558,7
+558,7
@@
int nukedir(char *dirname)
}
while (d = readdir(dp), d != NULL) {
}
while (d = readdir(dp), d != NULL) {
- s
printf(
filename, "%s/%s", dirname, d->d_name);
+ s
nprintf(filename, sizeof
filename, "%s/%s", dirname, d->d_name);
unlink(filename);
}
unlink(filename);
}
diff --git
a/citadel/routines.h
b/citadel/routines.h
index 8e37f89762e3f74f290d52b490d91ba2a6b6de4e..af723b6945154191effd03707957e35ccdb9913a 100644
(file)
--- a/
citadel/routines.h
+++ b/
citadel/routines.h
@@
-10,3
+10,4
@@
int nukedir(char *dirname);
int num_parms(char *source);
void strproc(char *string);
void back(int spaces);
int num_parms(char *source);
void strproc(char *string);
void back(int spaces);
+void progress(long int curr, long int cmax);
diff --git
a/citadel/routines2.c
b/citadel/routines2.c
index dd314c96493ab76fa2fcaedba40327347dc1687a..e66ac3ce0deb2a7256fb6e01e883083ee41a8083 100644
(file)
--- a/
citadel/routines2.c
+++ b/
citadel/routines2.c
@@
-43,16
+43,7
@@
#include "snprintf.h"
#endif
#include "screen.h"
#include "snprintf.h"
#endif
#include "screen.h"
-
-void interr(int errnum);
-void strprompt(char *prompt, char *str, int len);
-void newprompt(char *prompt, char *str, int len);
-void sttybbs(int cmd);
-int inkey(void);
-void serv_write(char *buf, int nbytes);
-int haschar(char *st, int ch);
-void progress(long int curr, long int cmax);
-int yesno(void);
+#include "client_crypto.h"
extern char temp[];
extern char tempdir[];
extern char temp[];
extern char tempdir[];
diff --git
a/citadel/sendcommand.c
b/citadel/sendcommand.c
index 0ea558c065fb289df2270e8a9eaac01c17f9bcc0..01b4d5730ca459694722f7bae7ae8c7206784c6a 100644
(file)
--- a/
citadel/sendcommand.c
+++ b/
citadel/sendcommand.c
@@
-111,7
+111,7
@@
void np_attach_to_server(void)
attach_to_server(1, args, hostbuf, portbuf);
serv_gets(buf);
fprintf(stderr, "%s\n", &buf[4]);
attach_to_server(1, args, hostbuf, portbuf);
serv_gets(buf);
fprintf(stderr, "%s\n", &buf[4]);
- s
printf(
buf, "IPGM %d", config.c_ipgm_secret);
+ s
nprintf(buf, sizeof
buf, "IPGM %d", config.c_ipgm_secret);
serv_puts(buf);
serv_gets(buf);
fprintf(stderr, "%s\n", &buf[4]);
serv_puts(buf);
serv_gets(buf);
fprintf(stderr, "%s\n", &buf[4]);
diff --git
a/citadel/serv_bio.c
b/citadel/serv_bio.c
index 635a48ed027eac6c75295e921a01b93b66c582df..b8f812a3c561b32b384bfb0d307f451571986580 100644
(file)
--- a/
citadel/serv_bio.c
+++ b/
citadel/serv_bio.c
@@
-60,7
+60,7
@@
void cmd_ebio(char *cmdbuf) {
return;
}
return;
}
- s
printf(buf,
"./bio/%ld",CC->usersupp.usernum);
+ s
nprintf(buf, sizeof buf,
"./bio/%ld",CC->usersupp.usernum);
fp = fopen(buf,"w");
if (fp == NULL) {
cprintf("%d Cannot create file\n",ERROR);
fp = fopen(buf,"w");
if (fp == NULL) {
cprintf("%d Cannot create file\n",ERROR);
@@
-87,7
+87,7
@@
void cmd_rbio(char *cmdbuf)
cprintf("%d No such user.\n",ERROR+NO_SUCH_USER);
return;
}
cprintf("%d No such user.\n",ERROR+NO_SUCH_USER);
return;
}
- s
printf(buf,
"./bio/%ld",ruser.usernum);
+ s
nprintf(buf, sizeof buf,
"./bio/%ld",ruser.usernum);
cprintf("%d OK|%s|%ld|%d|%ld|%ld|%ld\n", LISTING_FOLLOWS,
ruser.fullname, ruser.usernum, ruser.axlevel,
cprintf("%d OK|%s|%ld|%d|%ld|%ld|%ld\n", LISTING_FOLLOWS,
ruser.fullname, ruser.usernum, ruser.axlevel,
diff --git
a/citadel/serv_expire.c
b/citadel/serv_expire.c
index 13a18636fae448b6c424ed5447e22d6c9d3e0317..7c9965ad54cbd14f01f06a134e1a4ef40675a54b 100644
(file)
--- a/
citadel/serv_expire.c
+++ b/
citadel/serv_expire.c
@@
-335,7
+335,7
@@
int PurgeRooms(void) {
while (RoomPurgeList != NULL) {
if (getroom(&qrbuf, RoomPurgeList->name) == 0) {
transcript=reallok(transcript, strlen(transcript)+SIZ);
while (RoomPurgeList != NULL) {
if (getroom(&qrbuf, RoomPurgeList->name) == 0) {
transcript=reallok(transcript, strlen(transcript)+SIZ);
- s
printf(&transcript[strlen(transcript)]
, " %s\n",
+ s
nprintf(&transcript[strlen(transcript)], SIZ
, " %s\n",
qrbuf.QRname);
delete_room(&qrbuf);
}
qrbuf.QRname);
delete_room(&qrbuf);
}
@@
-433,7
+433,7
@@
int PurgeUsers(void) {
while (UserPurgeList != NULL) {
transcript=reallok(transcript, strlen(transcript)+SIZ);
while (UserPurgeList != NULL) {
transcript=reallok(transcript, strlen(transcript)+SIZ);
- s
printf(&transcript[strlen(transcript)]
, " %s\n",
+ s
nprintf(&transcript[strlen(transcript)], SIZ
, " %s\n",
UserPurgeList->name);
purge_user(UserPurgeList->name);
pptr = UserPurgeList->next;
UserPurgeList->name);
purge_user(UserPurgeList->name);
pptr = UserPurgeList->next;
diff --git
a/citadel/serv_imap.c
b/citadel/serv_imap.c
index 381649b9d47e4b689257e9d7d210a029b91aa514..b3804ffbe8e9a66d03af434264e38e4f6a418ac1 100644
(file)
--- a/
citadel/serv_imap.c
+++ b/
citadel/serv_imap.c
@@
-543,7
+543,7
@@
void imap_lsub(int num_parms, char *parms[]) {
cprintf("%s BAD arguments invalid\r\n", parms[0]);
return;
}
cprintf("%s BAD arguments invalid\r\n", parms[0]);
return;
}
- s
printf(
pattern, "%s%s", parms[2], parms[3]);
+ s
nprintf(pattern, sizeof
pattern, "%s%s", parms[2], parms[3]);
if (strlen(parms[3])==0) {
cprintf("* LIST (\\Noselect) \"|\" \"\"\r\n");
if (strlen(parms[3])==0) {
cprintf("* LIST (\\Noselect) \"|\" \"\"\r\n");
@@
-592,7
+592,7
@@
void imap_list(int num_parms, char *parms[]) {
cprintf("%s BAD arguments invalid\r\n", parms[0]);
return;
}
cprintf("%s BAD arguments invalid\r\n", parms[0]);
return;
}
- s
printf(
pattern, "%s%s", parms[2], parms[3]);
+ s
nprintf(pattern, sizeof
pattern, "%s%s", parms[2], parms[3]);
if (strlen(parms[3])==0) {
cprintf("* LIST (\\Noselect) \"|\" \"\"\r\n");
if (strlen(parms[3])==0) {
cprintf("* LIST (\\Noselect) \"|\" \"\"\r\n");
diff --git
a/citadel/serv_network.c
b/citadel/serv_network.c
index 164e890c9d9ecd75078c42785b279741f7e25326..67baa62a27e21f92f7a92750348e998b38180a10 100644
(file)
--- a/
citadel/serv_network.c
+++ b/
citadel/serv_network.c
@@
-215,7
+215,8
@@
void write_network_map(void) {
serialized_map = reallok(serialized_map,
(strlen(serialized_map)+SIZ) );
if (strlen(nmptr->nodename) > 0) {
serialized_map = reallok(serialized_map,
(strlen(serialized_map)+SIZ) );
if (strlen(nmptr->nodename) > 0) {
- sprintf(&serialized_map[strlen(serialized_map)],
+ snprintf(&serialized_map[strlen(serialized_map)],
+ SIZ,
"%s|%ld|%s\n",
nmptr->nodename,
(long)nmptr->lastcontact,
"%s|%ld|%s\n",
nmptr->nodename,
(long)nmptr->lastcontact,
@@
-424,15
+425,16
@@
void network_spool_msg(long msgnum, void *userdata) {
(long)instr_len);
abort();
}
(long)instr_len);
abort();
}
- s
printf(instr
,
+ s
nprintf(instr, instr_len
,
"Content-type: %s\n\nmsgid|%ld\nsubmitted|%ld\n"
"bounceto|postmaster@%s\n" ,
SPOOLMIME, msgnum, (long)time(NULL), config.c_fqdn );
/* Generate delivery instructions for each recipient */
for (nptr = sc->listrecps; nptr != NULL; nptr = nptr->next) {
"Content-type: %s\n\nmsgid|%ld\nsubmitted|%ld\n"
"bounceto|postmaster@%s\n" ,
SPOOLMIME, msgnum, (long)time(NULL), config.c_fqdn );
/* Generate delivery instructions for each recipient */
for (nptr = sc->listrecps; nptr != NULL; nptr = nptr->next) {
- sprintf(&instr[strlen(instr)], "remote|%s|0||\n",
- nptr->name);
+ size_t tmp = strlen(instr);
+ snprintf(&instr[tmp], instr_len - tmp,
+ "remote|%s|0||\n", nptr->name);
}
/*
}
/*
@@
-458,6
+460,7
@@
void network_spool_msg(long msgnum, void *userdata) {
msg = CtdlFetchMessage(msgnum);
if (msg != NULL) {
msg = CtdlFetchMessage(msgnum);
if (msg != NULL) {
+ size_t newpath_len;
/* Prepend our node name to the Path field whenever
* sending a message to another IGnet node
/* Prepend our node name to the Path field whenever
* sending a message to another IGnet node
@@
-465,10
+468,11
@@
void network_spool_msg(long msgnum, void *userdata) {
if (msg->cm_fields['P'] == NULL) {
msg->cm_fields['P'] = strdoop("username");
}
if (msg->cm_fields['P'] == NULL) {
msg->cm_fields['P'] = strdoop("username");
}
- newpath = mallok(strlen(msg->cm_fields['P']) +
- strlen(config.c_nodename) + 2);
- sprintf(newpath, "%s!%s", config.c_nodename,
- msg->cm_fields['P']);
+ newpath_len = strlen(msg->cm_fields['P']) +
+ strlen(config.c_nodename) + 2;
+ newpath = mallok(newpath_len);
+ snprintf(newpath, newpath_len, "%s!%s",
+ config.c_nodename, msg->cm_fields['P']);
phree(msg->cm_fields['P']);
msg->cm_fields['P'] = newpath;
phree(msg->cm_fields['P']);
msg->cm_fields['P'] = newpath;
@@
-523,7
+527,7
@@
void network_spool_msg(long msgnum, void *userdata) {
/* Send the message */
if (send == 1) {
/* Send the message */
if (send == 1) {
- s
printf(
filename,
+ s
nprintf(filename, sizeof
filename,
"./network/spoolout/%s",
nptr->name);
fp = fopen(filename, "ab");
"./network/spoolout/%s",
nptr->name);
fp = fopen(filename, "ab");
@@
-705,12
+709,13
@@
void network_bounce(struct CtdlMessage *msg, char *reason) {
struct recptypes *valid = NULL;
char force_room[ROOMNAMELEN];
static int serialnum = 0;
struct recptypes *valid = NULL;
char force_room[ROOMNAMELEN];
static int serialnum = 0;
+ size_t size;
lprintf(9, "entering network_bounce()\n");
if (msg == NULL) return;
lprintf(9, "entering network_bounce()\n");
if (msg == NULL) return;
- s
printf(
bouncesource, "%s@%s", BOUNCESOURCE, config.c_nodename);
+ s
nprintf(bouncesource, sizeof
bouncesource, "%s@%s", BOUNCESOURCE, config.c_nodename);
/*
* Give it a fresh message ID
/*
* Give it a fresh message ID
@@
-718,7
+723,7
@@
void network_bounce(struct CtdlMessage *msg, char *reason) {
if (msg->cm_fields['I'] != NULL) {
phree(msg->cm_fields['I']);
}
if (msg->cm_fields['I'] != NULL) {
phree(msg->cm_fields['I']);
}
- s
printf(
buf, "%ld.%04lx.%04x@%s",
+ s
nprintf(buf, sizeof
buf, "%ld.%04lx.%04x@%s",
(long)time(NULL), (long)getpid(), ++serialnum, config.c_fqdn);
msg->cm_fields['I'] = strdoop(buf);
(long)time(NULL), (long)getpid(), ++serialnum, config.c_fqdn);
msg->cm_fields['I'] = strdoop(buf);
@@
-766,8
+771,9
@@
void network_bounce(struct CtdlMessage *msg, char *reason) {
else {
oldpath = strdoop("unknown_user");
}
else {
oldpath = strdoop("unknown_user");
}
- msg->cm_fields['P'] = mallok(strlen(oldpath) + SIZ);
- sprintf(msg->cm_fields['P'], "%s!%s", config.c_nodename, oldpath);
+ size = strlen(oldpath) + SIZ;
+ msg->cm_fields['P'] = mallok(size);
+ snprintf(msg->cm_fields['P'], size, "%s!%s", config.c_nodename, oldpath);
phree(oldpath);
/* Now submit the message */
phree(oldpath);
/* Now submit the message */
@@
-844,9
+850,9
@@
void network_process_buffer(char *buffer, long size) {
else {
oldpath = strdoop("unknown_user");
}
else {
oldpath = strdoop("unknown_user");
}
- msg->cm_fields['P'] =
-
mallok(strlen(oldpath) + SIZ
);
- s
printf(msg->cm_fields['P']
, "%s!%s",
+ size = strlen(oldpath) + SIZ;
+
msg->cm_fields['P'] = mallok(size
);
+ s
nprintf(msg->cm_fields['P'], size
, "%s!%s",
config.c_nodename, oldpath);
phree(oldpath);
config.c_nodename, oldpath);
phree(oldpath);
@@
-854,7
+860,7
@@
void network_process_buffer(char *buffer, long size) {
serialize_message(&sermsg, msg);
/* now send it */
serialize_message(&sermsg, msg);
/* now send it */
- s
printf(
filename,
+ s
nprintf(filename, sizeof
filename,
"./network/spoolout/%s",
msg->cm_fields['D']);
fp = fopen(filename, "ab");
"./network/spoolout/%s",
msg->cm_fields['D']);
fp = fopen(filename, "ab");
@@
-884,7
+890,7
@@
void network_process_buffer(char *buffer, long size) {
* Check to see if we already have a copy of this message
*/
if (network_usetable(msg) != 0) {
* Check to see if we already have a copy of this message
*/
if (network_usetable(msg) != 0) {
- s
printf(
buf,
+ s
nprintf(buf, sizeof
buf,
"Loopzapper rejected message <%s> "
"from <%s> in <%s> @ <%s>\n",
((msg->cm_fields['I']!=NULL)?(msg->cm_fields['I']):""),
"Loopzapper rejected message <%s> "
"from <%s> in <%s> @ <%s>\n",
((msg->cm_fields['I']!=NULL)?(msg->cm_fields['I']):""),
@@
-1027,7
+1033,7
@@
void network_do_spoolin(void) {
if (dp == NULL) return;
while (d = readdir(dp), d != NULL) {
if (dp == NULL) return;
while (d = readdir(dp), d != NULL) {
- s
printf(
filename, "./network/spoolin/%s", d->d_name);
+ s
nprintf(filename, sizeof
filename, "./network/spoolin/%s", d->d_name);
network_process_file(filename);
}
network_process_file(filename);
}
@@
-1069,7
+1075,7
@@
void receive_spool(int sock, char *remote_nodename) {
}
while (bytes_received < download_len) {
}
while (bytes_received < download_len) {
- s
printf(
buf, "READ %ld|%ld",
+ s
nprintf(buf, sizeof
buf, "READ %ld|%ld",
bytes_received,
((download_len - bytes_received > IGNET_PACKET_SIZE)
? IGNET_PACKET_SIZE : (download_len - bytes_received)));
bytes_received,
((download_len - bytes_received > IGNET_PACKET_SIZE)
? IGNET_PACKET_SIZE : (download_len - bytes_received)));
@@
-1105,7
+1111,7
@@
void receive_spool(int sock, char *remote_nodename) {
return;
}
lprintf(9, "%s\n", buf);
return;
}
lprintf(9, "%s\n", buf);
- s
printf(
buf, "mv %s ./network/spoolin/%s.%ld",
+ s
nprintf(buf, sizeof
buf, "mv %s ./network/spoolin/%s.%ld",
tempfilename, remote_nodename, (long) getpid());
system(buf);
}
tempfilename, remote_nodename, (long) getpid());
system(buf);
}
@@
-1131,7
+1137,7
@@
void transmit_spool(int sock, char *remote_nodename)
return;
}
return;
}
- s
printf(
sfname, "./network/spoolout/%s", remote_nodename);
+ s
nprintf(sfname, sizeof
sfname, "./network/spoolout/%s", remote_nodename);
fd = open(sfname, O_RDONLY);
if (fd < 0) {
if (errno == ENOENT) {
fd = open(sfname, O_RDONLY);
if (fd < 0) {
if (errno == ENOENT) {
@@
-1145,7
+1151,7
@@
void transmit_spool(int sock, char *remote_nodename)
while (plen = (long) read(fd, pbuf, IGNET_PACKET_SIZE), plen > 0L) {
bytes_to_write = plen;
while (bytes_to_write > 0L) {
while (plen = (long) read(fd, pbuf, IGNET_PACKET_SIZE), plen > 0L) {
bytes_to_write = plen;
while (bytes_to_write > 0L) {
- s
printf(
buf, "WRIT %ld", bytes_to_write);
+ s
nprintf(buf, sizeof
buf, "WRIT %ld", bytes_to_write);
if (sock_puts(sock, buf) < 0) {
close(fd);
return;
if (sock_puts(sock, buf) < 0) {
close(fd);
return;
@@
-1205,7
+1211,7
@@
void network_poll_node(char *node, char *secret, char *host, char *port) {
lprintf(9, ">%s\n", buf);
/* Identify ourselves */
lprintf(9, ">%s\n", buf);
/* Identify ourselves */
- s
printf(
buf, "NETP %s|%s", config.c_nodename, secret);
+ s
nprintf(buf, sizeof
buf, "NETP %s|%s", config.c_nodename, secret);
lprintf(9, "<%s\n", buf);
if (sock_puts(sock, buf) <0) goto bail;
if (sock_gets(sock, buf) < 0) goto bail;
lprintf(9, "<%s\n", buf);
if (sock_puts(sock, buf) <0) goto bail;
if (sock_gets(sock, buf) < 0) goto bail;
diff --git
a/citadel/serv_pop3.c
b/citadel/serv_pop3.c
index 048459a27679b286d988a122b012b4f11e6af65d..92a02c12b23864b88e56e3583bd790ccef072cc2 100644
(file)
--- a/
citadel/serv_pop3.c
+++ b/
citadel/serv_pop3.c
@@
-450,7
+450,7
@@
void pop3_update(void) {
lgetuser(&CC->usersupp, CC->curr_user);
CtdlGetRelationship(&vbuf, &CC->usersupp, &CC->quickroom);
lgetuser(&CC->usersupp, CC->curr_user);
CtdlGetRelationship(&vbuf, &CC->usersupp, &CC->quickroom);
- s
printf(
vbuf.v_seen, "*:%ld",
+ s
nprintf(vbuf.v_seen, sizeof
vbuf.v_seen, "*:%ld",
POP3->msgs[POP3->num_msgs-1].msgnum);
CtdlSetRelationship(&vbuf, &CC->usersupp, &CC->quickroom);
POP3->msgs[POP3->num_msgs-1].msgnum);
CtdlSetRelationship(&vbuf, &CC->usersupp, &CC->quickroom);
diff --git
a/citadel/serv_smtp.c
b/citadel/serv_smtp.c
index 25082d77c12e04fca656e6bedf7f3a17de98c94c..7334ca0fbe406986f67d6245b812affd01c13187 100644
(file)
--- a/
citadel/serv_smtp.c
+++ b/
citadel/serv_smtp.c
@@
-110,8
+110,8
@@
void smtp_greeting(void) {
CtdlAllocUserData(SYM_SMTP, sizeof(struct citsmtp));
CtdlAllocUserData(SYM_SMTP_RECPS, SIZ);
CtdlAllocUserData(SYM_SMTP_ROOMS, SIZ);
CtdlAllocUserData(SYM_SMTP, sizeof(struct citsmtp));
CtdlAllocUserData(SYM_SMTP_RECPS, SIZ);
CtdlAllocUserData(SYM_SMTP_ROOMS, SIZ);
- s
printf(SMTP_RECPS
, "%s", "");
- s
printf(SMTP_ROOMS
, "%s", "");
+ s
nprintf(SMTP_RECPS, SIZ
, "%s", "");
+ s
nprintf(SMTP_ROOMS, SIZ
, "%s", "");
cprintf("220 %s ESMTP Citadel/UX server ready.\r\n", config.c_fqdn);
}
cprintf("220 %s ESMTP Citadel/UX server ready.\r\n", config.c_fqdn);
}
@@
-620,7
+620,8
@@
void smtp_command_loop(void) {
* Called by smtp_do_procmsg() to attempt delivery to one SMTP host
*
*/
* Called by smtp_do_procmsg() to attempt delivery to one SMTP host
*
*/
-void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum)
+void smtp_try(const char *key, const char *addr, int *status,
+ char *dsn, size_t n, long msgnum)
{
int sock = (-1);
char mxhosts[1024];
{
int sock = (-1);
char mxhosts[1024];
@@
-646,7
+647,7
@@
void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum)
msg_fp = tmpfile();
if (msg_fp == NULL) {
*status = 4;
msg_fp = tmpfile();
if (msg_fp == NULL) {
*status = 4;
- s
printf(ds
n, "Error creating temporary file");
+ s
nprintf(dsn,
n, "Error creating temporary file");
return;
}
else {
return;
}
else {
@@
-1197,7
+1198,7
@@
void smtp_do_procmsg(long msgnum, void *userdata) {
--i;
--lines;
lprintf(9, "SMTP: Trying <%s>\n", addr);
--i;
--lines;
lprintf(9, "SMTP: Trying <%s>\n", addr);
- smtp_try(key, addr, &status, dsn, text_msgid);
+ smtp_try(key, addr, &status, dsn,
sizeof dsn,
text_msgid);
if (status != 2) {
if (results == NULL) {
results = mallok(1024);
if (status != 2) {
if (results == NULL) {
results = mallok(1024);
@@
-1207,7
+1208,7
@@
void smtp_do_procmsg(long msgnum, void *userdata) {
results = reallok(results,
strlen(results) + 1024);
}
results = reallok(results,
strlen(results) + 1024);
}
- s
printf(&results[strlen(results)]
,
+ s
nprintf(&results[strlen(results)], 1024
,
"%s|%s|%d|%s\n",
key, addr, status, dsn);
}
"%s|%s|%d|%s\n",
key, addr, status, dsn);
}
diff --git
a/citadel/server_main.c
b/citadel/server_main.c
index bc330df66e4f70c5147ed166f646c7acc38ba3fc..c7b73329c1dd59659502e25e9912886beb6e8f20 100644
(file)
--- a/
citadel/server_main.c
+++ b/
citadel/server_main.c
@@
-70,6
+70,7
@@
int main(int argc, char **argv)
int drop_root_perms = 1;
char *moddir;
struct worker_node *wnp;
int drop_root_perms = 1;
char *moddir;
struct worker_node *wnp;
+ size_t size;
/* specify default port name and trace file */
strcpy(tracefile, "");
/* specify default port name and trace file */
strcpy(tracefile, "");
@@
-170,8
+171,9
@@
int main(int argc, char **argv)
* Load any server-side modules (plugins) available here.
*/
lprintf(7, "Initializing loadable modules\n");
* Load any server-side modules (plugins) available here.
*/
lprintf(7, "Initializing loadable modules\n");
- if ((moddir = malloc(strlen(bbs_home_directory) + 9)) != NULL) {
- sprintf(moddir, "%s/modules", bbs_home_directory);
+ size = strlen(bbs_home_directory) + 9;
+ if ((moddir = mallok(size)) != NULL) {
+ snprintf(moddir, size, "%s/modules", bbs_home_directory);
DLoader_Init(moddir);
free(moddir);
}
DLoader_Init(moddir);
free(moddir);
}
diff --git
a/citadel/tools.c
b/citadel/tools.c
index bb7e2a9ed9fb38fb346fcdb99849c159fabefbb6..493e90b2ece55e923fce1bd6bbbc55087cd316e9 100644
(file)
--- a/
citadel/tools.c
+++ b/
citadel/tools.c
@@
-340,7
+340,7
@@
void striplt(char *buf)
/*
* Return the number of occurances of character ch in string st
*/
/*
* Return the number of occurances of character ch in string st
*/
-int haschar(char *st, int ch)
+int haschar(c
onst c
har *st, int ch)
{
int a, b;
b = 0;
{
int a, b;
b = 0;
diff --git
a/citadel/tools.h
b/citadel/tools.h
index 36532f40896149b0ae05fff048db4ac33d4bcd5b..57d03d89caa03b3048c3c140fd5abfdbbfe0092c 100644
(file)
--- a/
citadel/tools.h
+++ b/
citadel/tools.h
@@
-7,7
+7,7
@@
long int extract_long (char *source, long int parmnum);
void encode_base64(char *dest, char *source);
int decode_base64(char *dest, char *source, size_t length);
void striplt(char *);
void encode_base64(char *dest, char *source);
int decode_base64(char *dest, char *source, size_t length);
void striplt(char *);
-int haschar(char *st, int ch);
+int haschar(c
onst c
har *st, int ch);
int collapsed_strcmp(char *s1, char *s2);
void remove_token(char *source, int parmnum, char separator);
void fmt_date(char *buf, time_t thetime, int seconds);
int collapsed_strcmp(char *s1, char *s2);
void remove_token(char *source, int parmnum, char separator);
void fmt_date(char *buf, time_t thetime, int seconds);