From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Tolpin Message-Id: <200403231536.i2NFadOX035523@adat.davidashen.net> To: 'magic@adat.davidashen.net, -s@adat.davidashen.net, 9fans@cse.psu.edu, numbers'@adat.davidashen.net Content-Type: text/plain; charset=KOI8-R Subject: [9fans] magic numbers Date: Tue, 23 Mar 2004 19:36:39 +0400 Topicbox-Message-UUID: 3e78b428-eacd-11e9-9e20-41e7f4b1d025 I've tried to pattern a simple program I am writing after /sys/src/cmd/ip/telnet.c; I'm lost trying to figure out what each of the magic numbers means. dodial(char *dest) defines char name[2*NETPATHLEN] that is, 80 characters long. Why NETPATHLEN should be doubled? How is NETPATHLEN related to the length of address tuple? Then name is used to copy the result of netmkaddr to it; but internally the array netmkaddr stores its result in a static char addr[256] and if the host name is long enough, the stack becomes corrupt. In the same function, on the next line after char name[2*NETPATHLEN], devdir is defined as char devdir[40] Is 40 in fact NETPATHLEN? David