File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22using System . Linq ;
33using System . Net ;
44using System . Net . Sockets ;
5+ using System . Security . Cryptography ;
56using System . Threading ;
67using EchoServer . Abstractions ;
78
@@ -15,7 +16,11 @@ public class UdpTimedSender : IDisposable
1516 private readonly UdpClient _udpClient ;
1617 private Timer ? _timer ;
1718 private ushort _counter = 0 ;
18- private readonly Random _random = new Random ( ) ; // Створюємо один раз як поле класу
19+
20+ // S2245: Random is used only for generating test data payload, not for any security-sensitive operations
21+ #pragma warning disable S2245
22+ private readonly Random _random = new Random ( ) ;
23+ #pragma warning restore S2245
1924
2025 public UdpTimedSender ( string host , int port , ILogger logger )
2126 {
@@ -37,7 +42,7 @@ private void SendMessageCallback(object? state)
3742 try
3843 {
3944 byte [ ] samples = new byte [ 1024 ] ;
40- _random . NextBytes ( samples ) ; // Використовуємо поле класу замість локальної змінної
45+ _random . NextBytes ( samples ) ;
4146 _counter ++ ;
4247
4348 byte [ ] msg = ( new byte [ ] { 0x04 , 0x84 } )
You can’t perform that action at this time.
0 commit comments