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

[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
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment