From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Sat, 8 Sep 2012 22:28:33 -0700 Message-ID: From: Skip Tavakkolian To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [9fans] dns Topicbox-Message-UUID: b7c12130-ead7-11e9-9d60-3106f5b1d025 Thanks all. it's interesting that announce.c doesn't have the same problem: cpue% grep -n NETPATHLEN /sys/src/libc/*/*.[ch] /sys/src/libc/9sys/announce.c:73: strncpy(dir, buf, NETPATHLEN); /sys/src/libc/9sys/announce.c:74: dir[NETPATHLEN-1] = 0; /sys/src/libc/9sys/announce.c:124: strncpy(newdir, buf, NETPATHLEN); /sys/src/libc/9sys/announce.c:125: newdir[NETPATHLEN-1] = 0; /sys/src/libc/9sys/dial.c:48: char dir[NETPATHLEN+1]; /sys/src/libc/9sys/dial.c:229: strncpy(ds->dir, conn->dir, NETPATHLEN); /sys/src/libc/9sys/dcpuial.c:230: ds->dir[NETPATHLEN] = '\0'; /sys/src/libc/9sys/dial.c:459: snprint(conn->dir, NETPATHLEN, "%s/%s", cname, name); On Sat, Sep 8, 2012 at 9:26 PM, erik quanstrom wrote: > On Sat Sep 8 23:02:25 EDT 2012, charles.forsyth@gmail.com wrote: > >> No, I didn't explain it well. NETPATHLEN isn't named in the manual >> pages, so ndb/dns doesn't use it. On the other hand, dial does, but >> because it's ...LEN, it's an easy mistake to think of it as the length >> of a string, which wouldn't include the terminating zero byte, instead >> of the length of the underlying array. > > indeed, a fair number of recent dns issues have been this sort of confusion. > there is something in ndb/dns (at least for me) that induces confusion. > > - erik >