+Sat Mar 6 01:55:55 EST 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+ * client_chat.c: use memfmout(), *not* cprintf() to transmit express
+ messages. Calling cprintf() on strings >256 bytes crashes the server
+ * msgbase.c: minor logging fix in save_message()
+
1999-03-05 Nathan Bryant <bryant@cs.usm.maine.edu>
* sysdep.c: add undocumented -r flag to citserver to prevent it from
dropping root permissions.
static int seqnum = 0;
lprintf(9, "save_message(%s,%s,%s,%d,%d)\n",
- mtmp, rec, force_room, mailtype, generate_id);
+ mtmp, rec, force, mailtype, generate_id);
strcpy(force_room, force);
cprintf("Message ");
cprintf("from %s:\n", ptr->sender);
if (ptr->text != NULL)
- cprintf("%s\n\n", ptr->text);
+ memfmout(80, ptr->text, 0);
holdptr = ptr->next;
if (ptr->text != NULL) phree(ptr->text);
ptr->sender, /* sender of msg */
config.c_nodename); /* static for now */
if (ptr->text != NULL) {
- cprintf("%s", ptr->text);
+ memfmout(80, ptr->text, 0);
if (ptr->text[strlen(ptr->text)-1] != '\n') cprintf("\n");
phree(ptr->text);
}
struct ExpressMessage *newmsg, *findend;
char *un;
FILE *fp;
+ size_t msglen = 0;
+ int do_send = 0;
+
+ if (strlen(x_msg) > 0) {
+ msglen = strlen(x_msg) + 4;
+ do_send = 1;
+ }
/* find the target user's context and append the message */
begin_critical_section(S_SESSION_TABLE);
if ((!strcasecmp(un, x_user))
|| (!strcasecmp(x_user, "broadcast"))) {
- if (strlen(x_msg) > 0) {
+ if (do_send) {
newmsg = (struct ExpressMessage *)
mallok(sizeof (struct ExpressMessage));
memset(newmsg, 0,
strcpy(newmsg->sender, lun);
if (!strcasecmp(x_user, "broadcast"))
newmsg->flags |= EM_BROADCAST;
- newmsg->text = mallok(strlen(x_msg)+2);
- strcpy(newmsg->text, x_msg);
+ newmsg->text = mallok(msglen);
+ safestrncpy(newmsg->text, x_msg, msglen);
if (ccptr->FirstExpressMessage == NULL)
ccptr->FirstExpressMessage = newmsg;
end_critical_section(S_SESSION_TABLE);
/* Log the page to disk if configured to do so */
- if ((strlen(config.c_logpages) > 0) && (strlen(x_msg) > 0)) {
+ if ((strlen(config.c_logpages) > 0) && (do_send) ) {
fp = fopen(CC->temp, "wb");
fprintf(fp, "%c%c%c", 255, MES_NORMAL, 0);
fprintf(fp, "Psysop%c", 0);