fukuchi / libqrencode

A fast and compact QR Code encoding library
https://fukuchi.org/works/qrencode/
GNU Lesser General Public License v2.1
2.53k stars 592 forks source link

Fix the strncat Wformat-overflow warning when using gcc 11.3.0 #203

Closed hyyoxhk closed 1 year ago

hyyoxhk commented 1 year ago

Replacing strncpy with strcpy fixes this warnings References: https://stackoverflow.com/questions/53408543/strncat-wformat-overflow-warning-when-using-gcc-8-2-1

qrenc.c:797:25: warning: ‘strncat’ specified bound 2 equals source length [-Wstringop-overflow=] 797 | strncat(buffer, " ", 2); | ^~~~~~~~ qrenc.c:811:25: warning: ‘strncat’ specified bound 2 equals source length [-Wstringop-overflow=] 811 | strncat(buffer, " ", 2); | ^~~~~~~~ qrenc.c:818:25: warning: ‘strncat’ specified bound 2 equals source length [-Wstringop-overflow=] 818 | strncat(buffer, " ", 2); | ^~~~~~~~ qrenc.c:820:17: warning: ‘strncat’ specified bound 5 equals source length [-Wstringop-overflow=] 820 | strncat(buffer, "\033[0m\n", 5); | ^~~~~~~