From: DRC Date: Mon, 12 Nov 2018 18:27:23 +0000 (-0600) Subject: tjbench.c: Fix compiler warnings with GCC 8 X-Git-Tag: 2.0.1~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c701014dce5873801d465533fe52fbf6c52d4907;p=libjpeg-turbo tjbench.c: Fix compiler warnings with GCC 8 strncpy() may fail to truncate dst if len == strlen(dst). --- diff --git a/tjbench.c b/tjbench.c index 9ab0ea2..863e534 100644 --- a/tjbench.c +++ b/tjbench.c @@ -60,8 +60,8 @@ int tjErrorLine = -1, tjErrorCode = -1; if (strncmp(tjErrorStr, _tjErrorStr, JMSG_LENGTH_MAX) || \ strncmp(tjErrorMsg, m, JMSG_LENGTH_MAX) || \ tjErrorCode != _tjErrorCode || tjErrorLine != __LINE__) { \ - strncpy(tjErrorStr, _tjErrorStr, JMSG_LENGTH_MAX); \ - strncpy(tjErrorMsg, m, JMSG_LENGTH_MAX); \ + strncpy(tjErrorStr, _tjErrorStr, JMSG_LENGTH_MAX - 1); \ + strncpy(tjErrorMsg, m, JMSG_LENGTH_MAX - 1); \ tjErrorCode = _tjErrorCode; \ tjErrorLine = __LINE__; \ printf("WARNING in line %d while %s:\n%s\n", __LINE__, m, _tjErrorStr); \