The previous fix for "type" was absolutely lousy. Not only the buffer

allocated was not big enough, but it ended up to being used where it
was supposed to be used. The person who did that ought to be shot, but
since I'm a good person, I'll forgive myself...

PR:		bin/9743
This commit is contained in:
Daniel C. Sobral 1999-02-04 13:06:47 +00:00
parent aa8b85772f
commit 7505875a0a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=43599

View File

@ -2781,7 +2781,7 @@ static void type(FICL_VM *pVM)
{
UNS32 count = stackPopUNS32(pVM->pStack);
char *cp = stackPopPtr(pVM->pStack);
char *pDest = (char *)ficlMalloc(count);
char *pDest = (char *)ficlMalloc(count + 1);
/*
** Since we don't have an output primitive for a counted string
@ -2794,7 +2794,7 @@ static void type(FICL_VM *pVM)
strncpy(pDest, cp, count);
pDest[count] = '\0';
vmTextOut(pVM, cp, 0);
vmTextOut(pVM, pDest, 0);
ficlFree(pDest);
return;