From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Sat, 13 Oct 2018 10:38:40 +0000 Subject: [PATCH] partitions/ldm: Off by one in ldm_relative() Message-Id: <20181013103840.GA22816@mwanda> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: "Richard Russon (FlatCap)" Cc: Jens Axboe , linux-ntfs-dev@lists.sourceforge.net, linux-block@vger.kernel.org, kernel-janitors@vger.kernel.org The > should be >= or otherwise we could end up reading one element beyond the end of the array. Signed-off-by: Dan Carpenter --- block/partitions/ldm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c index 16766f267559..f48bcd2f5226 100644 --- a/block/partitions/ldm.c +++ b/block/partitions/ldm.c @@ -636,7 +636,7 @@ static int ldm_relative(const u8 *buffer, int buflen, int base, int offset) { base += offset; - if (!buffer || offset < 0 || base > buflen) { + if (!buffer || offset < 0 || base >= buflen) { if (!buffer) ldm_error("!buffer"); if (offset < 0) -- 2.18.0