From e20db01247d769288d4d078585ce93735b90da4a Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Fri, 8 Jan 2021 04:59:54 +0000 Subject: [PATCH] Apply Solaris patch 065-CR7110983 This change is pulled from here: https://github.com/oracle/solaris-userland/blob/master/components/ksh93/patches/065-CR7110983.patch Unfortunately there is no publicly available documentation on what it does. We just have to assume the Solaris people knew what they were doing. It looks like this fixes a memory leak in nv_putval(). This patch was also applied by ksh2020: https://github.com/att/ast/commit/056386400a47ea2fb47633779f119193678b28fe --- src/cmd/ksh93/sh/name.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cmd/ksh93/sh/name.c b/src/cmd/ksh93/sh/name.c index 77c2f335a..dc3b27ac8 100644 --- a/src/cmd/ksh93/sh/name.c +++ b/src/cmd/ksh93/sh/name.c @@ -1888,7 +1888,10 @@ void nv_putval(register Namval_t *np, const char *string, int flags) else { if(size==0 && nv_isattr(np,NV_HOST)!=NV_HOST &&nv_isattr(np,NV_LJUST|NV_RJUST|NV_ZFILL)) + { nv_setsize(np,size=dot); + tofree = up->cp; + } else if(size > dot) dot = size; else if(nv_isattr(np,NV_LJUST|NV_RJUST)==NV_LJUST && dot>size)