From 6971cf795cfefed91bba87c76eee0e8a28d22b7c Mon Sep 17 00:00:00 2001 From: Todor Tomov Date: Tue, 4 Jan 2011 11:49:55 +0200 Subject: media.c: fix array overrun in media_entity_subtype_to_string() Fix overrun of static arrays node_types and subdev_types in media_entity_subtype_to_string(). Signed-off-by: Todor Tomov --- media.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/media.c b/media.c index 813a38f..75ca24c 100644 --- a/media.c +++ b/media.c @@ -82,12 +82,12 @@ static const char *media_entity_subtype_to_string(unsigned type) switch (type & MEDIA_ENTITY_TYPE_MASK) { case MEDIA_ENTITY_TYPE_NODE: - if (subtype > ARRAY_SIZE(node_types)) + if (subtype >= ARRAY_SIZE(node_types)) subtype = 0; return node_types[subtype]; case MEDIA_ENTITY_TYPE_SUBDEV: - if (subtype > ARRAY_SIZE(subdev_types)) + if (subtype >= ARRAY_SIZE(subdev_types)) subtype = 0; return subdev_types[subtype]; default: -- cgit v1.2.3