瀏覽代碼

SER-324 fix: dont throw away terminating zero from payload

Jiri Kuthan 17 年之前
父節點
當前提交
35ab13d8b1
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      udp_server.c

+ 6 - 1
udp_server.c

@@ -477,7 +477,12 @@ int udp_rcv_loop()
 #ifdef USE_STUN
 		}
 #endif
-#ifndef USE_STUN
+/* historically, zero-terminated packets indicated a bug in clients
+ * that calculated wrongly packet length and included string-terminating
+ * zero; today clients exist with legitimate binary payloads and we
+ * shall not check for zero-terminated payloads
+ */
+#ifdef TRASH_ZEROTERMINATED_PACKETS
 		if (buf[len-1]==0) {
 			tmp=ip_addr2a(&ri.src_ip);
 			LOG(L_WARN, "WARNING: udp_rcv_loop: "