diff -Nru /n/sources/plan9/sys/src/libdraw/event.c /sys/src/libdraw/event.c --- /n/sources/plan9/sys/src/libdraw/event.c Fri May 9 22:00:25 2008 +++ /sys/src/libdraw/event.c Sun Nov 6 00:00:00 2016 @@ -434,7 +434,7 @@ char buf[2*12+2]; int n; - n = sprint(buf, "m%d %d", pt.x, pt.y); + n = snprint(buf, sizeof buf, "m%d %d", pt.x, pt.y); write(mousefd, buf, n); } diff -Nru /n/sources/plan9/sys/src/libdraw/init.c /sys/src/libdraw/init.c --- /n/sources/plan9/sys/src/libdraw/init.c Fri Jan 25 18:36:15 2013 +++ /sys/src/libdraw/init.c Sun Nov 6 00:00:00 2016 @@ -220,7 +220,7 @@ if(t == nil) return nil; - sprint(buf, "%s/draw/new", dev); + snprint(buf, sizeof buf, "%s/draw/new", dev); ctlfd = open(buf, ORDWR|OCEXEC); if(ctlfd < 0){ if(bind("#i", dev, MAFTER) < 0){ @@ -244,11 +244,11 @@ isnew = 0; if(n < NINFO) /* this will do for now, we need something better here */ isnew = 1; - sprint(buf, "%s/draw/%d/data", dev, atoi(info+0*12)); + snprint(buf, sizeof buf, "%s/draw/%d/data", dev, atoi(info+0*12)); datafd = open(buf, ORDWR|OCEXEC); if(datafd < 0) goto Error2; - sprint(buf, "%s/draw/%d/refresh", dev, atoi(info+0*12)); + snprint(buf, sizeof buf, "%s/draw/%d/refresh", dev, atoi(info+0*12)); reffd = open(buf, OREAD|OCEXEC); if(reffd < 0){ Error3: diff -Nru /n/sources/plan9/sys/src/libdraw/keyboard.c /sys/src/libdraw/keyboard.c --- /n/sources/plan9/sys/src/libdraw/keyboard.c Mon Sep 2 12:34:51 2002 +++ /sys/src/libdraw/keyboard.c Sun Nov 6 00:00:00 2016 @@ -59,6 +59,7 @@ Keyboardctl* initkeyboard(char *file) { + int nb; Keyboardctl *kc; char *t; @@ -69,13 +70,14 @@ file = "/dev/cons"; kc->file = strdup(file); kc->consfd = open(file, ORDWR|OCEXEC); - t = malloc(strlen(file)+16); + nb = strlen(file)+16; + t = malloc(nb); if(kc->consfd<0 || t==nil){ Error1: free(kc); return nil; } - sprint(t, "%sctl", file); + snprint(t, nb, "%sctl", file); kc->ctlfd = open(t, OWRITE|OCEXEC); if(kc->ctlfd < 0){ fprint(2, "initkeyboard: can't open %s: %r\n", t); diff -Nru /n/sources/plan9/sys/src/libdraw/readcolmap.c /sys/src/libdraw/readcolmap.c --- /n/sources/plan9/sys/src/libdraw/readcolmap.c Thu Feb 28 20:24:37 2002 +++ /sys/src/libdraw/readcolmap.c Sun Nov 6 00:00:00 2016 @@ -26,7 +26,7 @@ USED(screen); - sprint(buf, "/dev/draw/%d/colormap", d->dirno); + snprint(buf, sizeof buf, "/dev/draw/%d/colormap", d->dirno); b = Bopen(buf, OREAD); if(b == 0) drawerror(d, "rdcolmap: can't open colormap device"); diff -Nru /n/sources/plan9/sys/src/libdraw/writecolmap.c /sys/src/libdraw/writecolmap.c --- /n/sources/plan9/sys/src/libdraw/writecolmap.c Fri Apr 13 22:11:10 2007 +++ /sys/src/libdraw/writecolmap.c Sun Nov 6 00:00:00 2016 @@ -15,7 +15,7 @@ char buf[64], *t; ulong r, g, b; - sprint(buf, "/dev/draw/%d/colormap", d->dirno); + snprint(buf, sizeof buf, "/dev/draw/%d/colormap", d->dirno); fd = open(buf, OWRITE); if(fd < 0) drawerror(d, "writecolmap: open colormap failed"); diff -Nru /n/sources/plan9/sys/src/libdraw/writeimage.c /sys/src/libdraw/writeimage.c --- /n/sources/plan9/sys/src/libdraw/writeimage.c Thu Feb 28 20:24:37 2002 +++ /sys/src/libdraw/writeimage.c Sun Nov 6 00:00:00 2016 @@ -66,7 +66,7 @@ if(nb != dy*bpl) goto ErrOut; } - sprint(hdr, "compressed\n%11s %11d %11d %11d %11d ", + snprint(hdr, sizeof hdr, "compressed\n%11s %11d %11d %11d %11d ", chantostr(cbuf, i->chan), r.min.x, r.min.y, r.max.x, r.max.y); if(write(fd, hdr, 11+5*12) != 11+5*12) goto ErrOut; @@ -172,7 +172,7 @@ if(loutp == outbuf) goto ErrOut; n = loutp-outbuf; - sprint(hdr, "%11d %11ld ", r.max.y, n); + snprint(hdr, sizeof hdr, "%11d %11ld ", r.max.y, n); write(fd, hdr, 2*12); write(fd, outbuf, n); r.min.y = r.max.y; diff -Nru /n/sources/plan9/sys/src/libdraw/writesubfont.c /sys/src/libdraw/writesubfont.c --- /n/sources/plan9/sys/src/libdraw/writesubfont.c Sun Dec 12 01:22:05 1999 +++ /sys/src/libdraw/writesubfont.c Sun Nov 6 00:00:00 2016 @@ -27,7 +27,7 @@ uchar *data; int nb; - sprint(hdr, "%11d %11d %11d ", f->n, f->height, f->ascent); + snprint(hdr, sizeof hdr, "%11d %11d %11d ", f->n, f->height, f->ascent); if(write(fd, hdr, 3*12) != 3*12){ Err: werrstr("writesubfont: bad write: %r");