diff src/oscar.c @ 1839:109cacf1ff97

[gaim-migrate @ 1849] now we don't require a hash server anymore. but it still has the ability to use one. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 11 May 2001 21:54:27 +0000
parents bee2239f5952
children 15a415b5f08c
line wrap: on
line diff
--- a/src/oscar.c	Fri May 11 08:20:00 2001 +0000
+++ b/src/oscar.c	Fri May 11 21:54:27 2001 +0000
@@ -681,6 +681,9 @@
 	g_free(pos);
 }
 
+/* size of icbmui.ocm, the largest module in AIM 3.5 */
+#define AIM_MAX_FILE_SIZE 98304
+
 int gaim_memrequest(struct aim_session_t *sess,
 		    struct command_rx_struct *command, ...) {
 	va_list ap;
@@ -695,10 +698,25 @@
 	va_end(ap);
 
 	if (len == 0) {
+		debug_printf("len is 0, hashing NULL\n");
 		aim_sendmemblock(sess, command->conn, offset, len, NULL,
 				AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
 		return 1;
 	}
+	if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) {
+		char buf[8];
+		buf[0] = offset & 0xff;
+		buf[1] = (offset >> 8) & 0xff;
+		buf[2] = (offset >> 16) & 0xff;
+		buf[3] = (offset >> 24) & 0xff;
+		buf[4] = len & 0xff;
+		buf[5] = (len >> 8) & 0xff;
+		buf[6] = (len >> 16) & 0xff;
+		buf[7] = (len >> 24) & 0xff;
+		debug_printf("len + offset is invalid, hashing request\n");
+		aim_sendmemblock(sess, command->conn, offset, 8, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST);
+		return 1;
+	}
 
 	pos = g_new0(struct pieceofcrap, 1);
 	pos->gc = sess->aux_data;