drm: fix potential out of bound read

If the specified chroma had only 1 or 2 characters, this would overflow.
This commit is contained in:
Rémi Denis-Courmont 2022-03-22 21:47:27 +02:00 committed by Hugo Beauzée-Luyssen
parent dc8f95ec89
commit eca00803d0
1 changed files with 1 additions and 1 deletions

View File

@ -167,7 +167,7 @@ static int Open(vout_display_t *vd,
char *chroma = var_InheritString(vd, "kms-drm-chroma");
if (chroma) {
drm_fourcc = VLC_FOURCC(chroma[0], chroma[1], chroma[2], chroma[3]);
memcpy(&drm_fourcc, chroma, strnlen(chroma, sizeof (drm_fourcc)));
msg_Dbg(vd, "Setting DRM chroma to '%4s'", chroma);
free(chroma);
}