Introduction
Introduction Statistics Contact Development Disclaimer Help
Don't allow overlapping strcpy. - sam - An updated version of the sam text edit…
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
commit c2dc0bc20739803cac5d1c9ab450f32734c56fe7
parent 04656a34bd9c853f3bcaa7cf00a240675e35a8f1
Author: Rob King <[email protected]>
Date: Thu, 22 Sep 2016 11:06:40 -0500
Don't allow overlapping strcpy.
Diffstat:
libframe/frbox.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/libframe/frbox.c b/libframe/frbox.c
@@ -117,8 +117,10 @@ chopbox(Frame *f, Frbox *b, int n) /* drop first n chars;…
{
if(b->nrune<0 || b->nrune<n)
berror("chopbox");
- strcpy((char*)b->a.ptr, (char*)runeindex(b->a.ptr, n));
+ memmove(b->a.ptr, runeindex(b->a.ptr, n), b->nrune - n);
+ // XXX strcpy((char*)b->a.ptr, (char*)runeindex(b->a.ptr, n));
b->nrune -= n;
+ b->a.ptr[b->nrune] = 0;
b->wid = strwidth(f->font, (char *)b->a.ptr);
}
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.