resubmitted as requested. Reference: /n/sources/patch/applied/strtochan3 Date: Thu Jun 1 02:47:12 CES 2006 Signed-off-by: quanstro@quanstro.net --- /sys/src/libdraw/chan.c Thu Jun 1 02:46:41 2006 +++ /sys/src/libdraw/chan.c Thu Jun 1 02:46:38 2006 @@ -41,9 +41,10 @@ { char *p, *q; ulong c; - int t, n; + int t, n, d; c = 0; + d = 0; p=s; while(*p && isspace(*p)) p++; @@ -55,9 +56,12 @@ if(p[1] < '0' || p[1] > '9') return 0; n = p[1]-'0'; + d += n; c = (c<<8) | __DC(t, n); p += 2; } + if(d==0 || (d>8 && d%8) || (d<8 && 8%d)) + return 0; return c; }