[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: a49d25364d ("staging/atomisp: Add support for the Intel IPU v2")

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Dan Carpenter 2017-05-18 10:50:19 -03:00 committed by Mauro Carvalho Chehab
parent 02d978318b
commit d1fec5bdeb

View file

@ -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;