From: Sami Kerola Date: Tue, 7 Feb 2012 21:31:03 +0000 (+0100) Subject: libblkid: verify arroy bound before reference [cppcheck] X-Git-Tag: v2.21~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=358ef9c0d17d21d450067aceaffd90635e8845b8;p=thirdparty%2Futil-linux.git libblkid: verify arroy bound before reference [cppcheck] [libblkid/src/read.c:428]: (style) Array index end is used before limits check Signed-off-by: Sami Kerola --- diff --git a/libblkid/src/read.c b/libblkid/src/read.c index b284ff004e..60d13db0cf 100644 --- a/libblkid/src/read.c +++ b/libblkid/src/read.c @@ -425,7 +425,7 @@ void blkid_read_cache(blkid_cache cache) continue; end = strlen(buf) - 1; /* Continue reading next line if it ends with a backslash */ - while (buf[end] == '\\' && end < sizeof(buf) - 2 && + while (end < (sizeof(buf) - 2) && buf[end] == '\\' && fgets(buf + end, sizeof(buf) - end, file)) { end = strlen(buf) - 1; lineno++;