shithub: vdir

Download patch

ref: f8eae3cf5fc1b25a399d5a999676baec21e1bc2a
parent: d03b0c36bceed888955d710d82e1af5564b8e55c
author: phil9 <[email protected]>
date: Wed Oct 6 14:53:16 EDT 2021

add boundary check in drawdir()

	make sure we're not trying to access an element beyond
	the array limits

--- a/vdir.c
+++ b/vdir.c
@@ -277,6 +277,8 @@
 	Rectangle r;
 	int dy;
 
+	if(offset+n>=ndirs)
+		return;
 	d = dirs[offset+n];
 	p = addpt(viewr.min, Pt(Toolpadding, Toolpadding));
 	p.y += n*lineh;