shithub: trueawk

Download patch

ref: 9666b77b369e342353c29eed5415123f58e58948
parent: 0575fbc687f4ce8de6e25848350069a44bbe48ff
parent: 0048c96e94c732c6fb2ebe50eeb3450c1672fe0f
author: ozan yigit <ozan.yigit@gmail.com>
date: Mon Oct 30 15:56:09 EDT 2023

todd miller's fix for big-endian systems, and out of bounds read
for empty CCL.

--- a/b.c
+++ b/b.c
@@ -529,7 +529,7 @@
 			setvec[lp] = 1;
 			setcnt++;
 		}
-		if (type(p) == CCL && (*(char *) right(p)) == '\0')
+		if (type(p) == CCL && (*(int *) right(p)) == 0)
 			return(0);		/* empty CCL */
 		return(1);
 	case PLUS:
@@ -970,7 +970,7 @@
 		rtok = relex();
 		if (rtok == ')') {	/* special pleading for () */
 			rtok = relex();
-			return unary(op2(CCL, NIL, (Node *) tostring("")));
+			return unary(op2(CCL, NIL, (Node *) cclenter("")));
 		}
 		np = regexp();
 		if (rtok == ')') {
@@ -993,7 +993,7 @@
 		return (concat(op2(CAT, np, primary())));
 	case EMPTYRE:
 		rtok = relex();
-		return (concat(op2(CAT, op2(CCL, NIL, (Node *) tostring("")),
+		return (concat(op2(CAT, op2(CCL, NIL, (Node *) cclenter("")),
 				primary())));
 	}
 	return (np);
--