1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 11:42:21 +00:00

Fix one buffer overflow in 'typeset -p .sh.type' (#457)

This small commit replaces one instance of memcmp with strncmp to
fix one of the buffer overflows that causes 'typeset -p .sh.type'
to crash (see also https://github.com/ksh93/ksh/issues/456).
This commit is contained in:
Johnothan King 2022-02-09 18:04:44 -08:00 committed by Martijn Dekker
parent f38494ea1d
commit a00fe6b7fd

View file

@ -1473,7 +1473,7 @@ int sh_outtype(Sfio_t *out)
{
if(nv_isnull(tp) || !nv_isvtree(tp))
continue;
if(indent && (memcmp(tp->nvname,sh.prefix,n-1) || tp->nvname[n-1]!='.' || strchr(tp->nvname+n,'.')))
if(indent && (strncmp(tp->nvname,sh.prefix,n-1) || tp->nvname[n-1]!='.' || strchr(tp->nvname+n,'.')))
continue;
nv_settype(L_ARGNOD,tp,0);
if(indent)