From: Art Cancro Date: Tue, 23 Dec 2003 03:53:49 +0000 (+0000) Subject: * Expanded the size of all string fields in "struct CtdlIPCMessage" to X-Git-Tag: v7.86~5660 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=285b6cda80b1c208a846885e8857a2015e9209e6;p=citadel.git * Expanded the size of all string fields in "struct CtdlIPCMessage" to the standard SIZ length, in order to accomodate "weird" messages without crashing. Also converted many strcpy()'s to safestrncpy()'s while populating this data structure, to avoid overruns. --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 38747b75a..c8ebd49ab 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,10 @@ $Log$ + Revision 613.10 2003/12/23 03:53:49 ajc + * Expanded the size of all string fields in "struct CtdlIPCMessage" to + the standard SIZ length, in order to accomodate "weird" messages + without crashing. Also converted many strcpy()'s to safestrncpy()'s + while populating this data structure, to avoid overruns. + Revision 613.9 2003/12/22 16:49:36 error * Add Preview for Mac OS X as an image viewer option in citadel.rc @@ -5193,3 +5199,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/citadel_ipc.c b/citadel/citadel_ipc.c index c960c1d5f..03891e2d7 100644 --- a/citadel/citadel_ipc.c +++ b/citadel/citadel_ipc.c @@ -482,23 +482,23 @@ int CtdlIPCGetSingleMessage(CtdlIPC *ipc, long msgnum, int headers, int as_mime, if (!strncasecmp(aaa, "nhdr=yes", 8)) mret[0]->nhdr = 1; else if (!strncasecmp(aaa, "from=", 5)) - strcpy(mret[0]->author, &aaa[5]); + safestrncpy(mret[0]->author, &aaa[5], SIZ); else if (!strncasecmp(aaa, "type=", 5)) mret[0]->type = atoi(&aaa[5]); else if (!strncasecmp(aaa, "msgn=", 5)) - strcpy(mret[0]->msgid, &aaa[5]); + safestrncpy(mret[0]->msgid, &aaa[5], SIZ); else if (!strncasecmp(aaa, "subj=", 5)) - strcpy(mret[0]->subject, &aaa[5]); + safestrncpy(mret[0]->subject, &aaa[5], SIZ); else if (!strncasecmp(aaa, "rfca=", 5)) - strcpy(mret[0]->email, &aaa[5]); + safestrncpy(mret[0]->email, &aaa[5], SIZ); else if (!strncasecmp(aaa, "hnod=", 5)) - strcpy(mret[0]->hnod, &aaa[5]); + safestrncpy(mret[0]->hnod, &aaa[5], SIZ); else if (!strncasecmp(aaa, "room=", 5)) - strcpy(mret[0]->room, &aaa[5]); + safestrncpy(mret[0]->room, &aaa[5], SIZ); else if (!strncasecmp(aaa, "node=", 5)) - strcpy(mret[0]->node, &aaa[5]); + safestrncpy(mret[0]->node, &aaa[5], SIZ); else if (!strncasecmp(aaa, "rcpt=", 5)) - strcpy(mret[0]->recipient, &aaa[5]); + safestrncpy(mret[0]->recipient, &aaa[5], SIZ); else if (!strncasecmp(aaa, "time=", 5)) mret[0]->time = atol(&aaa[5]); diff --git a/citadel/citadel_ipc.h b/citadel/citadel_ipc.h index 4ab3b1a4d..15b4abc19 100644 --- a/citadel/citadel_ipc.h +++ b/citadel/citadel_ipc.h @@ -99,11 +99,11 @@ struct ctdlipcmessage { char zaps[SIZ]; /* Message ID that this supersedes */ char subject[SIZ]; /* Message subject */ char email[SIZ]; /* Email address of sender */ - char author[USERNAME_SIZE]; /* Sender of message */ - char recipient[USERNAME_SIZE]; /* Recipient of message */ - char room[ROOMNAMELEN]; /* Originating room */ - char node[16]; /* Short nodename of origin system */ - char hnod[21]; /* Humannode of origin system */ + char author[SIZ]; /* Sender of message */ + char recipient[SIZ]; /* Recipient of message */ + char room[SIZ]; /* Originating room */ + char node[SIZ]; /* Short nodename of origin system */ + char hnod[SIZ]; /* Humannode of origin system */ struct parts *attachments; /* Available attachments */ char *text; /* Message text */ int type; /* Message type */