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
This commit is contained in:
committed by
Copybara-Service
parent
511cf27ff8
commit
5fe916045c
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user