Mesa (master): microsoft/compiler: Fix incorrect size passed to strncpy

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Jan 3 23:24:43 UTC 2021


Module: Mesa
Branch: master
Commit: bd97f401dc8ec76e717862c654a6ae29fcb93292
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd97f401dc8ec76e717862c654a6ae29fcb93292

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Mon Dec 28 10:44:08 2020 -0800

microsoft/compiler: Fix incorrect size passed to strncpy

GCC correctly detects/warns that this was the wrong size

Fixes: b9c61379 ("microsoft/compiler: translate nir to dxil")

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248>

---

 src/microsoft/compiler/dxil_signature.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/microsoft/compiler/dxil_signature.c b/src/microsoft/compiler/dxil_signature.c
index 9cd94b9ea8a..e44b16e8c58 100644
--- a/src/microsoft/compiler/dxil_signature.c
+++ b/src/microsoft/compiler/dxil_signature.c
@@ -163,7 +163,7 @@ get_semantic_sv_name(nir_variable *var, struct semantic_info *info)
    default:
       unreachable("unsupported system value");
    }
-   strncpy(info->name, var->name, 64);
+   strncpy(info->name, var->name, ARRAY_SIZE(info->name) - 1);
 }
 
 static void



More information about the mesa-commit mailing list