From 1c37aefcbd0aebc1f2043b3e9d2c9fd61e6275ef Mon Sep 17 00:00:00 2001 From: James Zern Date: Mon, 20 Mar 2023 17:09:42 -0700 Subject: [PATCH] svc_encodeframe.c: fix -Wstringop-truncation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit use sizeof(buf) - 1 with strncpy. fixes: examples/svc_encodeframe.c:282:3: warning: ‘strncpy’ specified bound 1024 equals destination size [-Wstringop-truncation] 282 | strncpy(si->options, options, sizeof(si->options)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I46980872f9865ae1dc2b56330c3a65d8bc6cf1f7 --- examples/svc_encodeframe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/svc_encodeframe.c b/examples/svc_encodeframe.c index 003096e..c2b3ec9 100644 --- a/examples/svc_encodeframe.c +++ b/examples/svc_encodeframe.c @@ -279,7 +279,7 @@ vpx_codec_err_t vpx_svc_set_options(SvcContext *svc_ctx, const char *options) { if (svc_ctx == NULL || options == NULL || si == NULL) { return VPX_CODEC_INVALID_PARAM; } - strncpy(si->options, options, sizeof(si->options)); + strncpy(si->options, options, sizeof(si->options) - 1); si->options[sizeof(si->options) - 1] = '\0'; return VPX_CODEC_OK; } -- 2.7.4