$Log$
+ Revision 614.49 2004/02/24 05:09:06 ajc
+ * Better validation of incoming network messages.
+
Revision 614.48 2004/02/23 16:10:47 nbryant
--disable-pie by default.
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
msg->cm_fields['T'] = strdoop(aaa);
}
+ /*
+ * If no Author, set it to ME ME ME
+ */
+ if (msg->cm_fields['A'] == NULL) {
+ msg->cm_fields['A'] = strdoop(CC->user.fullname);
+ }
+
+ /*
+ * If no Node, set it to the local node
+ */
+ if (msg->cm_fields['N'] == NULL) {
+ msg->cm_fields['N'] = strdoop(config.c_nodename);
+ }
+
/* If this message has no path, we generate one.
*/
if (msg->cm_fields['P'] == NULL) {
lprintf(9, "Learning what's inside\n");
if (msg->cm_fields['M'] == NULL) {
lprintf(1, "ERROR: attempt to save message with NULL body\n");
+ return(-1);
}
switch (msg->cm_format_type) {
char filename[SIZ];
FILE *fp;
char nexthop[SIZ];
+ unsigned char firstbyte;
+ unsigned char lastbyte;
+
+ /* Validate just a little bit. First byte should be FF and
+ * last byte should be 00.
+ */
+ memcpy(&firstbyte, &buffer[0], 1);
+ memcpy(&lastbyte, &buffer[size-1], 1);
+ if ( (firstbyte != 255) || (lastbyte != 0) ) {
+ lprintf(7, "Corrupt message! Ignoring.\n");
+ return;
+ }
/* Set default target room to trash */
strcpy(target_room, TWITROOM);