expect/expect-5.45-match-gt-numchars-segfault.patch
Petr Šabata c89f70f1b7 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/expect#e13e9cb80d4c0f7031b80814385a34effd4ee7c4
2020-10-15 00:10:59 +02:00

18 lines
591 B
Diff

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