When sending a response in the server or passive mode, make sure the
response is not longer than the request to prevent amplification
attacks when resposes may contain extension fields (e.g. NTS).
UTI_IsEqualAnyNtp64(&message.transmit_ts, &message.receive_ts,
&message.originate_ts, local_ntp_tx));
+ if (request_info && request_info->length < info.length) {
+ DEBUG_LOG("Response longer than request req_len=%d res_len=%d",
+ request_info->length, info.length);
+ return 0;
+ }
+
ret = NIO_SendPacket(&message, where_to, from, info.length, local_tx != NULL);
if (local_tx) {