* Expanded the size of all string fields in "struct CtdlIPCMessage" to
authorArt Cancro <ajc@citadel.org>
Tue, 23 Dec 2003 03:53:49 +0000 (03:53 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 23 Dec 2003 03:53:49 +0000 (03:53 +0000)
  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.

citadel/ChangeLog
citadel/citadel_ipc.c
citadel/citadel_ipc.h

index 38747b75abcd0b162e72a906a64df9d175dc5a7f..c8ebd49ab3e268825d67d72da76b65b058b63a03 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index c960c1d5ffb65035aa25ff245da44a938e978ec4..03891e2d793c985274002382e645c712cbe3fe35 100644 (file)
@@ -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]);
 
index 4ab3b1a4db0908757b23c1c5936fb9d975832fe4..15b4abc1979147c976c963236f96ea01ac944e97 100644 (file)
@@ -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 */