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

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