1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Fix off-by-one in nv_mktype() (Solaris patch 210-Bug15993811)

This change is pulled from here:
https://github.com/oracle/solaris-userland/blob/master/components/ksh93/patches/210-Bug15993811.patch

Unfortunately there is no publicly available documentation on why
this change was needed. We just have to assume the Solaris people
knew what they were doing. ksh2020 upstreamed this too (as well as
all the other Solaris patches applied here).
This commit is contained in:
Martijn Dekker 2021-01-08 11:56:04 +00:00
parent ba4989d974
commit ad9ea0ba7d

View file

@ -904,8 +904,6 @@ Namval_t *nv_mktype(Namval_t **nodes, int numnodes)
} }
offset = roundof(offset,sizeof(char*)); offset = roundof(offset,sizeof(char*));
nv_setsize(mp,offset); nv_setsize(mp,offset);
if(nd)
nd++;
k = roundof(sizeof(Namtype_t),sizeof(Sfdouble_t)) - sizeof(Namtype_t); k = roundof(sizeof(Namtype_t),sizeof(Sfdouble_t)) - sizeof(Namtype_t);
pp = newof(NiL, Namtype_t, 1, nnodes*NV_MINSZ + offset + size + (nnodes+nd)*sizeof(char*) + iref*sizeof(struct Namref)+k); pp = newof(NiL, Namtype_t, 1, nnodes*NV_MINSZ + offset + size + (nnodes+nd)*sizeof(char*) + iref*sizeof(struct Namref)+k);
pp->fun.dsize = sizeof(Namtype_t)+nnodes*NV_MINSZ +offset+k; pp->fun.dsize = sizeof(Namtype_t)+nnodes*NV_MINSZ +offset+k;