shithub: hx

Download patch

ref: 4b1f7e9e8ec2c3f9c4eb1fa4ea8226430aadb54e
parent: 5788a6536a136a541c4987d97a8ef225275d2e9b
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sat Jan 14 18:33:49 EST 2023

make sure "off" is never negative

--- a/hx.c
+++ b/hx.c
@@ -135,8 +135,11 @@
 	if (sz >= 0) {
 		if (eof == 0 && lineoff > 0 && lineoff < 16) {
 			eof = 1;
-			if (lineoff == 8)
+			if (lineoff == 8) {
 				off--;
+				if (off < 0)
+					off = 0;
+			}
 			for (; lineoff < 16; lineoff++) {
 				line[lineoff] = 0;
 				s[off++] = ' ';