From 5fe916045cd9deaf8a8e6803c35660db209b8280 Mon Sep 17 00:00:00 2001 From: Kevin Zakka Date: Fri, 5 Jun 2026 11:25:20 -0700 Subject: [PATCH] Replace strncpy with memcpy for gridlayout initialization. memcpy is more appropriate here as the source and destination buffers have the same size, ensuring the entire buffer is copied. PiperOrigin-RevId: 927395770 Change-Id: Idbe9dade3160f593060fae5783743b28c0452695 --- src/user/user_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/user/user_init.c b/src/user/user_init.c index 9a7274e8..a05258fd 100644 --- a/src/user/user_init.c +++ b/src/user/user_init.c @@ -272,7 +272,7 @@ void mjs_defaultTexture(mjsTexture* texture) { texture->gridsize[0] = texture->gridsize[1] = 1; texture->nchannel = 3; char defaultlayout[sizeof(texture->gridlayout)] = "............"; - strncpy(texture->gridlayout, defaultlayout, sizeof(texture->gridlayout)); + memcpy(texture->gridlayout, defaultlayout, sizeof(texture->gridlayout)); }