mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-12 00:00:00 +00:00
s390/dcss: array index 'i' is used before limits check.
Avoid out-of-bounds-read by checking count before indexing. Signed-off-by : Ameen Ali <Ameenali023@gmail.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
a13ccb04af
commit
3a9f9183bd
@ -547,7 +547,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
|
||||
* parse input
|
||||
*/
|
||||
num_of_segments = 0;
|
||||
for (i = 0; ((buf[i] != '\0') && (buf[i] != '\n') && i < count); i++) {
|
||||
for (i = 0; (i < count && (buf[i] != '\0') && (buf[i] != '\n')); i++) {
|
||||
for (j = i; (buf[j] != ':') &&
|
||||
(buf[j] != '\0') &&
|
||||
(buf[j] != '\n') &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user