Skip to content

Commit 292eaf5

Browse files
hverkuilmchehab
authored andcommitted
[media] cec: fix off-by-one memset
The unused bytes of the features array should be zeroed, but the start index was one byte too early. This caused the device features byte to be overwritten by 0. The compliance test for the CEC_S_LOG_ADDRS ioctl didn't catch this because it tested byte continuation with the second device features byte being 0 :-( Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
1 parent cd70c37 commit 292eaf5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/staging/media/cec/cec-adap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ int __cec_s_log_addrs(struct cec_adapter *adap,
12521252
return -EINVAL;
12531253
}
12541254
/* Zero unused part of the feature array */
1255-
memset(features + i, 0, feature_sz - i);
1255+
memset(features + i + 1, 0, feature_sz - i - 1);
12561256
}
12571257

12581258
if (log_addrs->cec_version >= CEC_OP_CEC_VERSION_2_0) {

0 commit comments

Comments
 (0)