Amazingly picky bug fixes from Valgrind.

This commit is contained in:
rsc 2004-03-05 05:53:11 +00:00
parent 230d62c475
commit 15680d56a6
9 changed files with 20 additions and 9 deletions

View file

@ -115,9 +115,12 @@ static
void
chopbox(Frame *f, Frbox *b, int n) /* drop first n chars; no allocation done */
{
char *p;
if(b->nrune<0 || b->nrune<n)
drawerror(f->display, "chopbox");
strcpy((char*)b->ptr, (char*)runeindex(b->ptr, n));
p = (char*)runeindex(b->ptr, n);
memmove((char*)b->ptr, p, strlen(p)+1);
b->nrune -= n;
b->wid = stringwidth(f->font, (char *)b->ptr);
}