linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hfs: fix array out of bounds read of array extent
@ 2018-08-31 14:05 Colin King
  2018-10-17 17:49 ` Ernesto A. Fernández
       [not found] ` <20181017150117.fef4f8d8e814aa2d25adba5e@linux-foundation.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Colin King @ 2018-08-31 14:05 UTC (permalink / raw)
  To: linux-fsdevel, dhowells, viro; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently extent and index i are both being incremented causing
an array out of bounds read on extent[i]. Fix this by removing
the extraneous increment of extent.

Detected by CoverityScan, CID#711541 ("Out of bounds read")

Fixes: d1081202f1d0 ("HFS rewrite")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/hfs/extent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c
index 5d0182654580..636cdfcecb26 100644
--- a/fs/hfs/extent.c
+++ b/fs/hfs/extent.c
@@ -300,7 +300,7 @@ int hfs_free_fork(struct super_block *sb, struct hfs_cat_file *file, int type)
 		return 0;
 
 	blocks = 0;
-	for (i = 0; i < 3; extent++, i++)
+	for (i = 0; i < 3; i++)
 		blocks += be16_to_cpu(extent[i].count);
 
 	res = hfs_free_extents(sb, extent, blocks, blocks);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-18  7:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-31 14:05 [PATCH] hfs: fix array out of bounds read of array extent Colin King
2018-10-17 17:49 ` Ernesto A. Fernández
     [not found] ` <20181017150117.fef4f8d8e814aa2d25adba5e@linux-foundation.org>
2018-10-17 23:17   ` Al Viro
2018-10-17 23:28   ` Ernesto A. Fernández
2018-10-17 23:36   ` Viacheslav Dubeyko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).