Diff between 1760e5f5f512791ed007c976193da61ab4bec131 and 7f5cb418d3a9d0389a14f3f07f5e8240dff7b476

Changed Files

File Additions Deletions Status
gobex/gobex.c +5 -0 modified
unit/test-gobex.c +1 -1 modified

Full Patch

diff --git a/gobex/gobex.c b/gobex/gobex.c
index b4e809a..40c06cf 100644
--- a/gobex/gobex.c
+++ b/gobex/gobex.c
@@ -752,6 +752,11 @@ static gboolean incoming_data(GIOChannel *io, GIOCondition cond,
 		header_offset = rsp_header_offset(opcode);
 	} else {
 		opcode = obex->rx_buf[0] & ~FINAL_BIT;
+		/* Unexpected response -- fail silently */
+		if (opcode > 0x1f && opcode < 0xff) {
+			obex->rx_data = 0;
+			return TRUE;
+		}
 		header_offset = req_header_offset(opcode);
 		obex->rx_last_op = opcode;
 	}
diff --git a/unit/test-gobex.c b/unit/test-gobex.c
index 7a7cbe9..6d14b51 100644
--- a/unit/test-gobex.c
+++ b/unit/test-gobex.c
@@ -565,7 +565,7 @@ static void test_recv_unexpected(void)
 
 	g_obex_set_disconnect_function(obex, unexpected_disconn, &err);
 
-	req = g_obex_packet_new(G_OBEX_RSP_SUCCESS, TRUE, NULL);
+	req = g_obex_packet_new(G_OBEX_RSP_CONTINUE, TRUE, NULL);
 	len = g_obex_packet_encode(req, buf, sizeof(buf));
 	g_assert_cmpint(len, >=, 0);