[CRIU] [PATCH 07/15] tty: Check for valid index when collecting

Cyrill Gorcunov gorcunov at gmail.com
Fri Sep 7 19:18:28 MSK 2018


Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 criu/tty.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/criu/tty.c b/criu/tty.c
index 0f2a289d678a..a5b5a98e115b 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -1777,6 +1777,10 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i)
 		info->tfe->has_mnt_id = true;
 		info->tfe->mnt_id = 0;
 	}
+	if (info->tfe->tty_info_id > ((MAX_TTYS << 1))) {
+		pr_err("Too big index %u\n", info->tfe->tty_info_id);
+		return -1;
+	}
 	list_add_tail(&info->list, &collected_ttys);
 	return 0;
 }
-- 
2.17.1



More information about the CRIU mailing list