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

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