Created attachment 219832 [details] Don't reassign the "len" variable and compute the exact spaces needed Hi, The programmable completion of ksh2020 doesn't work as expected unless the prefix length is exactly 3. The following example illustrates the problem: $ set -o emacs $ _foo() > { > COMPREPLY=( hello world ) > } $ complete -F _foo foo $ foo <tab> # Nothing is displayed. $ foo hel<tab> # This one works as expected. The problem is caused by a reassignment of the prefix length. Moreover, we might overwrite data on the heap if the total length of all completion strings is big enough. The attached patch fixes the problem.
A commit references this bug: Author: cy Date: Wed Dec 2 18:43:36 UTC 2020 New revision: 556844 URL: https://svnweb.freebsd.org/changeset/ports/556844 Log: 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 Changes: head/shells/ksh2020/Makefile head/shells/ksh2020/files/patch-src_cmd_ksh93_edit_pcomplete.c
A commit references this bug: Author: cy Date: Thu Dec 3 04:22:52 UTC 2020 New revision: 556884 URL: https://svnweb.freebsd.org/changeset/ports/556884 Log: MFH: r556844 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> Approved by: ports-secteam (fluffy) Changes: _U branches/2020Q4/ branches/2020Q4/shells/ksh2020/Makefile branches/2020Q4/shells/ksh2020/files/patch-src_cmd_ksh93_edit_pcomplete.c
Committed. Thanks for the patch.