shithub: sl

Download patch

ref: a9dacbaed106828e03ca74be373171610fd9d452
parent: 1712b18a90b80757dbc96850744aa4c0c14fcfd1
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Apr 22 16:17:43 EDT 2025

outsn: fix out of bounds read

--- a/src/print.c
+++ b/src/print.c
@@ -28,7 +28,7 @@
 	if(nl == nil){
 		if((w = u8_strwidth(s, n)) > 0)
 			sl.hpos += w;
-	}else if((w = u8_strwidth(nl+1, s+n-nl+1)) > 0)
+	}else if((nl+1-s) < (intptr)n && (w = u8_strwidth(nl+1, s+n-nl-1)) > 0)
 		sl.hpos = w;
 }