codership / glb

Galera Load Balancer - a simple TCP connection proxy and load-balancing library
GNU General Public License v2.0
153 stars 51 forks source link

Use memcpy instead of strncpy to avoid stringop-truncation error #29

Closed temeo closed 3 years ago

temeo commented 3 years ago

Compilation fails with GCC 9 for -Werror=stringop-truncation in glb_dst.c. This is because strncpy() is used in a way which does not copy terminating NUL into dst buffer. To avoid the error, replace strncpy() with memcpy().

temeo commented 3 years ago

For discussion about strncpy(), see https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/.