From: Dimitri Papadopoulos Orfanos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com> Date: Thu, 18 Sep 2025 18:36:42 +0000 (+0200) Subject: Address static analysis warning X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b121d9a1ef066b1c6ba3e22e49ea7078aa79facd;p=users%2Fdwmw2%2Fopenconnect.git Address static analysis warning gpst.c: In function 'gpst_connect': gpst.c:723:46: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (13 chars into 12 available) [-Wunterminated-string-initialization] 723 | static const char start_tunnel[12] = "START_TUNNEL"; /* NOT zero-terminated */ | ^~~~~~~~~~~~~~ gpst.c: At top level: gpst.c:1433:38: warning: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (17 chars into 16 available) [-Wunterminated-string-initialization] 1433 | static char magic_ping_payload[16] = "monitor\x00\x00pan ha "; | ^~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Dimitri Papadopoulos Orfanos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com> --- diff --git a/gpst.c b/gpst.c index cb17bcd4..244aaf04 100644 --- a/gpst.c +++ b/gpst.c @@ -720,7 +720,7 @@ static int gpst_connect(struct openconnect_info *vpninfo) { int ret; struct oc_text_buf *reqbuf; - static const char start_tunnel[12] = "START_TUNNEL"; /* NOT zero-terminated */ + static const char start_tunnel[12] __attribute__((nonstring)) = "START_TUNNEL"; /* NOT NUL-terminated */ char buf[256]; /* We do NOT actually start the HTTPS tunnel if ESP is enabled and we received @@ -1430,7 +1430,7 @@ static inline uint16_t csum(void *buf, int nwords) return csum_finish(csum_partial(buf, nwords)); } -static char magic_ping_payload[16] = "monitor\x00\x00pan ha "; +static char magic_ping_payload[16] __attribute__((nonstring)) = "monitor\x00\x00pan ha "; /* NOT NUL-terminated */ int gpst_esp_send_probes(struct openconnect_info *vpninfo) {