Blame SOURCES/expect-5.45-match-gt-numchars-segfault.patch

0106b4
diff -up expect5.45/expect.c.orig expect5.45/expect.c
0106b4
--- expect5.45/expect.c.orig	2012-02-06 14:15:13.469490744 +0100
0106b4
+++ expect5.45/expect.c	2012-02-06 14:16:23.596837896 +0100
0106b4
@@ -2363,7 +2363,12 @@ expMatchProcess(
0106b4
 
0106b4
 	/* "!e" means no case matched - transfer by default */
0106b4
 	if (!e || e->transfer) {
0106b4
-	    int remainder = numchars-match;
0106b4
+	    int remainder;
0106b4
+	    if (match > numchars) {
0106b4
+		match = numchars;
0106b4
+		eo->matchlen = match;
0106b4
+	    }
0106b4
+	    remainder = numchars-match;
0106b4
 	    /* delete matched chars from input buffer */
0106b4
 	    esPtr->printed -= match;
0106b4
 	    if (numchars != 0) {