wangyu- / tinyfecVPN

A VPN Designed for Lossy Links, with Build-in Forward Error Correction(FEC) Support. Improves your Network Quality on a High-latency Lossy Link.
MIT License
2.28k stars 456 forks source link

Compilation encounters warning #120

Closed LanYunDev closed 3 weeks ago

LanYunDev commented 5 months ago

UDPspeeder/common.cpp: In member function 'char address_t::get_str()': UDPspeeder/common.cpp:312:24: warning: '%u' directive writing between 1 and 5 bytes into a region of size between 0 and 99 [-Wformat-overflow=] 312 | sprintf(s, "%s:%u", ip_addr, (u32_t)port); | ^~ UDPspeeder/common.cpp:312:20: note: directive argument in the range [0, 65535] 312 | sprintf(s, "%s:%u", ip_addr, (u32_t)port); | ^~~ UDPspeeder/common.cpp:312:16: note: 'sprintf' output between 3 and 106 bytes into a destination of size 100 312 | sprintf(s, "%s:%u", ip_addr, (u32_t)port); | ~^~~~~~~~ UDPspeeder/common.cpp:310:24: warning: ']:' directive writing 2 bytes into a region of size between 0 and 99 [-Wformat-overflow=] 310 | sprintf(s, "[%s]:%u", ip_addr, (u32_t)port); | ^~ UDPspeeder/common.cpp:310:20: note: directive argument in the range [0, 65535] 310 | sprintf(s, "[%s]:%u", ip_addr, (u32_t)port); | ^~~~~ UDPspeeder/common.cpp:310:16: note: 'sprintf' output between 5 and 108 bytes into a destination of size 100 310 | sprintf(s, "[%s]:%u", ip_addr, (u32_t)port); | ~^~~~~~~~~~ main.cpp: In function 'void print_help()': main.cpp:17:12: warning: 'char strncpy(char, const char, size_t)' output truncated copying 10 bytes from a string of length 40 [-Wstringop-truncation] 17 | strncpy(git_version_buf, gitversion, 10); | ~^~~~~~~

cmake version 3.28.1
gcc version 13.2.0 (Debian 13.2.0-7)
GNU Make 4.3
Linux x86_64 6.5.13
wangyu- commented 3 weeks ago

not big problem. It's not always worth the time to fix all those warnings IMO.

see also what libev author says.

image

nevertheless, I will try clear up some easy warnings when I have the free time.

LanYunDev commented 3 weeks ago

Thanks for the answers!