9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] magic numbers
@ 2004-03-23 15:36 David Tolpin
  0 siblings, 0 replies; only message in thread
From: David Tolpin @ 2004-03-23 15:36 UTC (permalink / raw)
  To: 'magic, -s, 9fans, numbers'



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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-03-23 15:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-23 15:36 [9fans] magic numbers David Tolpin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).