From: James Zern Date: Tue, 21 Mar 2023 00:09:42 +0000 (-0700) Subject: svc_encodeframe.c: fix -Wstringop-truncation X-Git-Tag: accepted/tizen/7.0/unified/20240521.012539~1^2~250^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c37aefcbd0aebc1f2043b3e9d2c9fd61e6275ef;p=platform%2Fupstream%2Flibvpx.git svc_encodeframe.c: fix -Wstringop-truncation 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 --- 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; }