فهرست منبع

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
 #ifdef USE_STUN
 		}
 		}
 #endif
 #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) {
 		if (buf[len-1]==0) {
 			tmp=ip_addr2a(&ri.src_ip);
 			tmp=ip_addr2a(&ri.src_ip);
 			LOG(L_WARN, "WARNING: udp_rcv_loop: "
 			LOG(L_WARN, "WARNING: udp_rcv_loop: "