mesa/main: do not copy the exact size of the string
This fixes a compiler warning with stringop-truncation:
```
error: 'strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation]
286 | strncpy(s, msg, MAX_DEBUG_MESSAGE_LENGTH);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18613>
This commit is contained in:
@@ -283,7 +283,7 @@ _mesa_gl_debug(struct gl_context *ctx,
|
||||
|
||||
/* limit the message to fit within KHR_debug buffers */
|
||||
char s[MAX_DEBUG_MESSAGE_LENGTH];
|
||||
strncpy(s, msg, MAX_DEBUG_MESSAGE_LENGTH);
|
||||
strncpy(s, msg, MAX_DEBUG_MESSAGE_LENGTH - 1);
|
||||
s[MAX_DEBUG_MESSAGE_LENGTH - 1] = '\0';
|
||||
len = MAX_DEBUG_MESSAGE_LENGTH - 1;
|
||||
_mesa_log_msg(ctx, source, type, *id, severity, len, s);
|
||||
|
||||
Reference in New Issue
Block a user