alibaba / xquic

XQUIC Library released by Alibaba is a cross-platform implementation of QUIC and HTTP/3 protocol.
Apache License 2.0
1.64k stars 326 forks source link

fix complie error: specified bound depends on the length of the source argument #312

Closed drawing closed 11 months ago

drawing commented 12 months ago

Fix compilation errors under gcc version 11.3.1 20221121 (Red Hat 11.3.1-4)

/tmp/build/xquic-1.5.2/src/tls/xqc_tls.c: In function 'xqc_tls_set_alpn': /tmp/build/xquic-1.5.2/src/tls/xqc_tls.c:172:5: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-truncation] 172 | strncpy(&p_alpn[1], alpn, protos_len); | ^~~~~~~~~ /tmp/build/xquic-1.5.2/src/tls/xqc_tls.c:152:23: note: length computed here 152 | size_t alpn_len = strlen(alpn); | ^~~~ cc1: all warnings being treated as errors

CLAassistant commented 12 months ago

CLA assistant check
All committers have signed the CLA.

Kulsk commented 11 months ago

LGTM