projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1eea103
)
sprintf bashing
author
Nathan Bryant
<loanshark@uncensored.citadel.org>
Tue, 12 Mar 2002 03:09:11 +0000
(
03:09
+0000)
committer
Nathan Bryant
<loanshark@uncensored.citadel.org>
Tue, 12 Mar 2002 03:09:11 +0000
(
03:09
+0000)
12 files changed:
citadel/messages.c
patch
|
blob
|
history
citadel/msgbase.c
patch
|
blob
|
history
citadel/room_ops.c
patch
|
blob
|
history
citadel/serv_chat.c
patch
|
blob
|
history
citadel/serv_ical.c
patch
|
blob
|
history
citadel/serv_imap.c
patch
|
blob
|
history
citadel/serv_vcard.c
patch
|
blob
|
history
citadel/tools.c
patch
|
blob
|
history
citadel/tools.h
patch
|
blob
|
history
citadel/user_ops.c
patch
|
blob
|
history
citadel/user_ops.h
patch
|
blob
|
history
citadel/userlist.c
patch
|
blob
|
history
diff --git
a/citadel/messages.c
b/citadel/messages.c
index 1a4e6308b93ae518a961b2ceddbcf6b707126fa1..707b9dc3da17370574cafd261361cffbd17355aa 100644
(file)
--- a/
citadel/messages.c
+++ b/
citadel/messages.c
@@
-515,7
+515,7
@@
int read_message(
}
}
else if (!strncasecmp(buf, "time=", 5)) {
}
}
else if (!strncasecmp(buf, "time=", 5)) {
- fmt_date(now, atol(&buf[5]), 0);
+ fmt_date(now,
sizeof now,
atol(&buf[5]), 0);
if (dest) {
fprintf(dest, "%s ", now);
} else {
if (dest) {
fprintf(dest, "%s ", now);
} else {
@@
-689,7
+689,7
@@
int client_make_message(char *filename, /* temporary file name */
mode = 0;
}
mode = 0;
}
- fmt_date(datestr, time(NULL), 0);
+ fmt_date(datestr,
sizeof datestr,
time(NULL), 0);
header[0] = 0;
if (room_flags & QR_ANONONLY && !recipient) {
header[0] = 0;
if (room_flags & QR_ANONONLY && !recipient) {
diff --git
a/citadel/msgbase.c
b/citadel/msgbase.c
index edafb1a6df69b3d5194920d2a5df711bb1132122..e2735f1e06df0b1afc1d7306f8bcd9035e36f37d 100644
(file)
--- a/
citadel/msgbase.c
+++ b/
citadel/msgbase.c
@@
-1903,7
+1903,7
@@
long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */
lprintf(9, "Delivering private local mail to <%s>\n",
recipient);
if (getuser(&userbuf, recipient) == 0) {
lprintf(9, "Delivering private local mail to <%s>\n",
recipient);
if (getuser(&userbuf, recipient) == 0) {
- MailboxName(actual_rm, &userbuf, MAILROOM);
+ MailboxName(actual_rm,
sizeof actual_rm,
&userbuf, MAILROOM);
CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 0);
}
else {
CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 0);
}
else {
@@
-2843,7
+2843,7
@@
void CtdlWriteObject(char *req_room, /* Room to stuff it in */
size_t len;
if (is_mailbox != NULL)
size_t len;
if (is_mailbox != NULL)
- MailboxName(roomname, is_mailbox, req_room);
+ MailboxName(roomname,
sizeof roomname,
is_mailbox, req_room);
else
safestrncpy(roomname, req_room, sizeof(roomname));
lprintf(9, "CtdlWriteObject() to <%s> (flags=%d)\n", roomname, flags);
else
safestrncpy(roomname, req_room, sizeof(roomname));
lprintf(9, "CtdlWriteObject() to <%s> (flags=%d)\n", roomname, flags);
diff --git
a/citadel/room_ops.c
b/citadel/room_ops.c
index ecaf8d84b0d4192daccca9f8e34ed23605b37ea7..ba41b87bd2c02652bc0f9a4a1fe4947b4f9d1217 100644
(file)
--- a/
citadel/room_ops.c
+++ b/
citadel/room_ops.c
@@
-811,7
+811,8
@@
void cmd_goto(char *gargs)
/* Then try a mailbox name match */
if (c != 0) {
/* Then try a mailbox name match */
if (c != 0) {
- MailboxName(augmented_roomname, &CC->usersupp, towhere);
+ MailboxName(augmented_roomname, sizeof augmented_roomname,
+ &CC->usersupp, towhere);
c = getroom(&QRscratch, augmented_roomname);
if (c == 0)
strcpy(towhere, augmented_roomname);
c = getroom(&QRscratch, augmented_roomname);
if (c == 0)
strcpy(towhere, augmented_roomname);
@@
-1344,7
+1345,7
@@
unsigned create_room(char *new_room_name,
* name accordingly (prepend the user number)
*/
if (new_room_type == 4) {
* name accordingly (prepend the user number)
*/
if (new_room_type == 4) {
- MailboxName(qrbuf.QRname, &CC->usersupp, new_room_name);
+ MailboxName(qrbuf.QRname,
sizeof qrbuf.QRname,
&CC->usersupp, new_room_name);
}
else {
safestrncpy(qrbuf.QRname, new_room_name, sizeof qrbuf.QRname);
}
else {
safestrncpy(qrbuf.QRname, new_room_name, sizeof qrbuf.QRname);
diff --git
a/citadel/serv_chat.c
b/citadel/serv_chat.c
index 8c86c71772e0e117fb61c81946d689bdb483a6e3..ceec50f6e0fd68728bbeae13614bad66c858f680 100644
(file)
--- a/
citadel/serv_chat.c
+++ b/
citadel/serv_chat.c
@@
-558,6
+558,7
@@
int send_express_message(char *lun, char *x_user, char *x_msg)
malloc(sizeof(struct savelist));
sptr->next = sl;
MailboxName(sptr->roomname,
malloc(sizeof(struct savelist));
sptr->next = sl;
MailboxName(sptr->roomname,
+ sizeof sptr->roomname,
&ccptr->usersupp, PAGELOGROOM);
sl = sptr;
}
&ccptr->usersupp, PAGELOGROOM);
sl = sptr;
}
diff --git
a/citadel/serv_ical.c
b/citadel/serv_ical.c
index e65ceda790d69cea45637a6d47e9cc73c14aa9e4..cc3c96ab23bf7bb9e8bf5fcc1d39d1f38b1733d6 100644
(file)
--- a/
citadel/serv_ical.c
+++ b/
citadel/serv_ical.c
@@
-83,7
+83,7
@@
int ical_obj_beforesave(struct CtdlMessage *msg)
*/
/* First determine if this is our room */
*/
/* First determine if this is our room */
- MailboxName(roomname, &CC->usersupp, USERCALENDARROOM);
+ MailboxName(roomname,
sizeof roomname,
&CC->usersupp, USERCALENDARROOM);
if (strncmp(roomname, msg->cm_fields['O'], ROOMNAMELEN))
return 0; /* It's not us... */
if (strncmp(roomname, msg->cm_fields['O'], ROOMNAMELEN))
return 0; /* It's not us... */
diff --git
a/citadel/serv_imap.c
b/citadel/serv_imap.c
index b3804ffbe8e9a66d03af434264e38e4f6a418ac1..87d58d965855883c72e9379419bfd98350e4ac7b 100644
(file)
--- a/
citadel/serv_imap.c
+++ b/
citadel/serv_imap.c
@@
-382,7
+382,8
@@
void imap_select(int num_parms, char *parms[]) {
/* Then try a mailbox name match */
if (c != 0) {
/* Then try a mailbox name match */
if (c != 0) {
- MailboxName(augmented_roomname, &CC->usersupp, towhere);
+ MailboxName(augmented_roomname, sizeof augmented_roomname,
+ &CC->usersupp, towhere);
c = getroom(&QRscratch, augmented_roomname);
if (c == 0)
strcpy(towhere, augmented_roomname);
c = getroom(&QRscratch, augmented_roomname);
if (c == 0)
strcpy(towhere, augmented_roomname);
@@
-671,7
+672,8
@@
int imap_grabroom(char *returned_roomname, char *foldername) {
/* Then try a mailbox name match */
if (c != 0) {
/* Then try a mailbox name match */
if (c != 0) {
- MailboxName(augmented_roomname, &CC->usersupp, roomname);
+ MailboxName(augmented_roomname, sizeof augmented_roomname,
+ &CC->usersupp, roomname);
c = getroom(&QRscratch, augmented_roomname);
if (c == 0)
strcpy(roomname, augmented_roomname);
c = getroom(&QRscratch, augmented_roomname);
if (c == 0)
strcpy(roomname, augmented_roomname);
diff --git
a/citadel/serv_vcard.c
b/citadel/serv_vcard.c
index c952f5d723cc99b95250768cc3e7cce986fed185..9e30a74923b6f374053758a92a84e78f71724c1a 100644
(file)
--- a/
citadel/serv_vcard.c
+++ b/
citadel/serv_vcard.c
@@
-280,7
+280,8
@@
int vcard_upload_beforesave(struct CtdlMessage *msg) {
* to make changes to another user's vCard instead of
* assuming that it's always the user saving his own.
*/
* to make changes to another user's vCard instead of
* assuming that it's always the user saving his own.
*/
- MailboxName(config_rm, &CC->usersupp, USERCONFIGROOM);
+ MailboxName(config_rm, sizeof config_rm,
+ &CC->usersupp, USERCONFIGROOM);
CtdlDeleteMessages(config_rm, 0L, "text/x-vcard");
/* Set the Extended-ID to a standardized one so the
CtdlDeleteMessages(config_rm, 0L, "text/x-vcard");
/* Set the Extended-ID to a standardized one so the
@@
-385,7
+386,7
@@
struct vCard *vcard_get_user(struct usersupp *u) {
struct vCard *v;
strcpy(hold_rm, CC->quickroom.QRname); /* save current room */
struct vCard *v;
strcpy(hold_rm, CC->quickroom.QRname); /* save current room */
- MailboxName(config_rm, u, USERCONFIGROOM);
+ MailboxName(config_rm,
sizeof config_rm,
u, USERCONFIGROOM);
if (getroom(&CC->quickroom, config_rm) != 0) {
getroom(&CC->quickroom, hold_rm);
if (getroom(&CC->quickroom, config_rm) != 0) {
getroom(&CC->quickroom, hold_rm);
diff --git
a/citadel/tools.c
b/citadel/tools.c
index 493e90b2ece55e923fce1bd6bbbc55087cd316e9..2c21bfe7ae30da84a2d0cf690c42a59a894b746e 100644
(file)
--- a/
citadel/tools.c
+++ b/
citadel/tools.c
@@
-393,7
+393,7
@@
int collapsed_strcmp(char *s1, char *s2) {
* Format a date/time stamp for output
* seconds is whether to print the seconds
*/
* Format a date/time stamp for output
* seconds is whether to print the seconds
*/
-void fmt_date(char *buf, time_t thetime, int seconds) {
+void fmt_date(char *buf,
size_t n,
time_t thetime, int seconds) {
struct tm *tm;
int hour;
struct tm *tm;
int hour;
@@
-410,7
+410,7
@@
void fmt_date(char *buf, time_t thetime, int seconds) {
else if (hour > 12) hour = hour - 12;
if (seconds) {
else if (hour > 12) hour = hour - 12;
if (seconds) {
- s
printf(buf
, "%s %d %4d %d:%02d:%02d%s",
+ s
nprintf(buf, n
, "%s %d %4d %d:%02d:%02d%s",
ascmonths[tm->tm_mon],
tm->tm_mday,
tm->tm_year + 1900,
ascmonths[tm->tm_mon],
tm->tm_mday,
tm->tm_year + 1900,
@@
-420,7
+420,7
@@
void fmt_date(char *buf, time_t thetime, int seconds) {
( (tm->tm_hour >= 12) ? "pm" : "am" )
);
} else {
( (tm->tm_hour >= 12) ? "pm" : "am" )
);
} else {
- s
printf(buf
, "%s %d %4d %d:%02d%s",
+ s
nprintf(buf, n
, "%s %d %4d %d:%02d%s",
ascmonths[tm->tm_mon],
tm->tm_mday,
tm->tm_year + 1900,
ascmonths[tm->tm_mon],
tm->tm_mday,
tm->tm_year + 1900,
@@
-454,7
+454,7
@@
int is_msg_in_mset(char *mset, long msgnum) {
if (num_tokens(setstr, ':') >= 2) {
extract_token(histr, setstr, 1, ':');
if (!strcmp(histr, "*")) {
if (num_tokens(setstr, ':') >= 2) {
extract_token(histr, setstr, 1, ':');
if (!strcmp(histr, "*")) {
- s
printf(
histr, "%ld", LONG_MAX);
+ s
nprintf(histr, sizeof
histr, "%ld", LONG_MAX);
}
}
else {
}
}
else {
diff --git
a/citadel/tools.h
b/citadel/tools.h
index 57d03d89caa03b3048c3c140fd5abfdbbfe0092c..e168a96ed46a2eeecc6d38ef1106710ed0476ccf 100644
(file)
--- a/
citadel/tools.h
+++ b/
citadel/tools.h
@@
-10,7
+10,7
@@
void striplt(char *);
int haschar(const char *st, int ch);
int collapsed_strcmp(char *s1, char *s2);
void remove_token(char *source, int parmnum, char separator);
int haschar(const char *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);
+void fmt_date(char *buf,
size_t n,
time_t thetime, int seconds);
int is_msg_in_mset(char *mset, long msgnum);
char *memreadline(char *start, char *buf, int maxlen);
int is_msg_in_mset(char *mset, long msgnum);
char *memreadline(char *start, char *buf, int maxlen);
diff --git
a/citadel/user_ops.c
b/citadel/user_ops.c
index 836fce4fc512ea6b177eb65c8089e0453b28f949..862ad30bdb14ee2f629d5101055aa155ea778af5 100644
(file)
--- a/
citadel/user_ops.c
+++ b/
citadel/user_ops.c
@@
-232,14
+232,14
@@
void CtdlGetRelationship(struct visit *vbuf,
/* Set v_seen if necessary */
if (vbuf->v_seen[0] == 0) {
/* Set v_seen if necessary */
if (vbuf->v_seen[0] == 0) {
- s
printf(
vbuf->v_seen, "*:%ld", vbuf->v_lastseen);
+ s
nprintf(vbuf->v_seen, sizeof
vbuf->v_seen, "*:%ld", vbuf->v_lastseen);
}
}
}
}
-void MailboxName(char *buf, s
truct usersupp *who,
char *prefix)
+void MailboxName(char *buf, s
ize_t n, const struct usersupp *who, const
char *prefix)
{
{
- s
printf(buf
, "%010ld.%s", who->usernum, prefix);
+ s
nprintf(buf, n
, "%010ld.%s", who->usernum, prefix);
}
}
@@
-729,7
+729,7
@@
int create_user(char *newusername, int become_user)
putuser(&usbuf);
/* give the user a private mailbox */
putuser(&usbuf);
/* give the user a private mailbox */
- MailboxName(mailboxname, &usbuf, MAILROOM);
+ MailboxName(mailboxname,
sizeof mailboxname,
&usbuf, MAILROOM);
create_room(mailboxname, 5, "", 0, 1);
/*** Everything below this line can be bypassed if we are administratively
create_room(mailboxname, 5, "", 0, 1);
/*** Everything below this line can be bypassed if we are administratively
@@
-1379,7
+1379,7
@@
int NewMailCount()
long *msglist = NULL;
int num_msgs = 0;
long *msglist = NULL;
int num_msgs = 0;
- MailboxName(mailboxname, &CC->usersupp, MAILROOM);
+ MailboxName(mailboxname,
sizeof mailboxname,
&CC->usersupp, MAILROOM);
if (getroom(&mailbox, mailboxname) != 0)
return (0);
CtdlGetRelationship(&vbuf, &CC->usersupp, &mailbox);
if (getroom(&mailbox, mailboxname) != 0)
return (0);
CtdlGetRelationship(&vbuf, &CC->usersupp, &mailbox);
diff --git
a/citadel/user_ops.h
b/citadel/user_ops.h
index e8e1338b7f3c792655c7d9fae5f3b28fae1755d6..ad9fdc4b1c0f32aad659afb413cc7313bd6c3785 100644
(file)
--- a/
citadel/user_ops.h
+++ b/
citadel/user_ops.h
@@
-40,7
+40,8
@@
void CtdlGetRelationship(struct visit *vbuf,
void CtdlSetRelationship(struct visit *newvisit,
struct usersupp *rel_user,
struct quickroom *rel_room);
void CtdlSetRelationship(struct visit *newvisit,
struct usersupp *rel_user,
struct quickroom *rel_room);
-void MailboxName(char *buf, struct usersupp *who, char *prefix);
+void MailboxName(char *buf, size_t n, const struct usersupp *who,
+ const char *prefix);
int GenerateRelationshipIndex( char *IndexBuf,
long RoomID,
long RoomGen,
int GenerateRelationshipIndex( char *IndexBuf,
long RoomID,
long RoomGen,
diff --git
a/citadel/userlist.c
b/citadel/userlist.c
index bd59f04a582cf1f4cef04f742065eafa7740339a..2570a7df1bd591231526ffc8aa9e09d6bbdb56cb 100644
(file)
--- a/
citadel/userlist.c
+++ b/
citadel/userlist.c
@@
-91,7
+91,7
@@
char *strerror(int e)
{
static char buf[32];
{
static char buf[32];
- s
printf(buf,
"errno = %d",e);
+ s
nprintf(buf, sizeof buf,
"errno = %d",e);
return(buf);
}
#endif
return(buf);
}
#endif