9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: David Tolpin <dvd@davidashen.net>
To: 'magic@adat.davidashen.net, -s@adat.davidashen.net,
	9fans@cse.psu.edu, numbers'@adat.davidashen.net
Subject: [9fans] magic numbers
Date: Tue, 23 Mar 2004 19:36:39 +0400	[thread overview]
Message-ID: <200403231536.i2NFadOX035523@adat.davidashen.net> (raw)



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



                 reply	other threads:[~2004-03-23 15:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200403231536.i2NFadOX035523@adat.davidashen.net \
    --to=dvd@davidashen.net \
    --cc='magic@adat.davidashen.net \
    --cc=-s@adat.davidashen.net \
    --cc=9fans@cse.psu.edu \
    --cc=numbers'@adat.davidashen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).