Don't reassign the "len" variable and compute the exact spaces needed.

PR:		251275
Submitted by:	Romeo Rajomalaza <endian.sign _ gmail.com>
Reported by:	Romeo Rajomalaza <endian.sign _ gmail.com>
MFH:		2020Q4
This commit is contained in:
Cy Schubert 2020-12-02 18:43:35 +00:00
parent addbef6bae
commit e49cde4c83
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=556844
2 changed files with 13 additions and 0 deletions

View File

@ -2,6 +2,7 @@
PORTNAME= ksh2020 PORTNAME= ksh2020
PORTVERSION= 2020 PORTVERSION= 2020
PORTREVISION= 1
CATEGORIES= shells CATEGORIES= shells
MAINTAINER= cy@FreeBSD.org MAINTAINER= cy@FreeBSD.org

View File

@ -0,0 +1,12 @@
--- src/cmd/ksh93/edit/pcomplete.c.orig 2020-11-20 14:41:10.427589000 +0000
+++ src/cmd/ksh93/edit/pcomplete.c 2020-11-20 14:47:28.958973000 +0000
@@ -338,8 +338,7 @@
}
if (complete) {
// Reserved space on stack and try again.
- len = 3;
- tlen = (c + 1) * sizeof(char *) + len * c + 1024;
+ tlen += (c + 1) * sizeof(char *) + (plen + slen + 1) * c;
stkseek(shp->stk, tlen);
complete = 2;
av = (char **)stkptr(shp->stk, 0);