Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1fec5bd authored by Dan Carpenter's avatar Dan Carpenter Committed by Mauro Carvalho Chehab
Browse files

[media] atomisp: one char read beyond end of string



We should verify that "ix < max_len" before we test whether we have
reached the NUL terminator.

Fixes: a49d2536 ("staging/atomisp: Add support for the Intel IPU v2")

Reported-by: default avatarDavid Binderman <dcb314@hotmail.com>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 02d97831
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -72,9 +72,8 @@ static size_t strnlen_s(
		return 0;
	}

	for (ix=0;
		((src_str[ix] != '\0') && (ix< max_len));
		++ix) /*Nothing else to do*/;
	for (ix = 0; ix < max_len && src_str[ix] != '\0'; ix++)
		;

	/* On Error, it will return src_size == max_len*/
	return ix;