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

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