diff src/protocols/oscar/ft.c @ 8446:d9cf0c2f4339

[gaim-migrate @ 9176] Some nice AIM over OSCAR file transfer cleanup from marv. This should make sending and receiving a bit smoother. Let one of us know if this causes something to crash. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 15 Mar 2004 01:30:16 +0000
parents aa755705bcf5
children 646ddb3a020b
line wrap: on
line diff
--- a/src/protocols/oscar/ft.c	Sun Mar 14 19:01:53 2004 +0000
+++ b/src/protocols/oscar/ft.c	Mon Mar 15 01:30:16 2004 +0000
@@ -175,7 +175,7 @@
 	int ret = 0;
 	aim_conn_t *newconn;
 	char ip[20];
-	int port;
+	unsigned short int port;
 
 	if ((acceptfd = accept(cur->fd, &addr, &addrlen)) == -1)
 		return 0; /* not an error */
@@ -204,7 +204,7 @@
 
 		priv = (struct aim_odc_intdata *)(newconn->internal = cur->internal);
 		cur->internal = NULL;
-		snprintf(priv->ip, sizeof(priv->ip), "%s:%u", ip, port);
+		snprintf(priv->ip, sizeof(priv->ip), "%s:%hu", ip, port);
 
 		if ((userfunc = aim_callhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED)))
 			ret = userfunc(sess, NULL, newconn, cur);
@@ -648,8 +648,10 @@
 	new->fh.rfcsum = 0xffff0000;
 	new->fh.recvcsum = 0xffff0000;
 	strncpy(new->fh.idstring, "OFT_Windows ICBMFT V1.1 32", 31);
-	if (filename)
+	if (filename) {
 		strncpy(new->fh.name, filename, 63);
+		new->fh.name[63] = '\0';
+	}
 
 	new->next = sess->oft_info;
 	sess->oft_info = new;
@@ -760,6 +762,7 @@
 	fh->nencode = aimbs_get16(bs);
 	fh->nlanguage = aimbs_get16(bs);
 	aimbs_getrawbuf(bs, fh->name, 64); /* XXX - filenames longer than 64B */
+	fh->name[63] = '\0';
 
 	return fh;
 }