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:
Corentin Noël
2022-09-15 14:49:22 +02:00
committed by Marge Bot
parent 2cdb3e4b6b
commit 9718c88baf
+1 -1
View File
@@ -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);