[157] in Moira

home help back first fref pref prev next nref lref last post

marc: 7.1D moira

daemon@ATHENA.MIT.EDU (Ezra Peisach)
Tue Aug 21 09:40:58 1990

To: bug-moira@ATHENA.MIT.EDU
Cc: marc@ATHENA.MIT.EDU
Date: Tue, 21 Aug 90 09:40:26 EDT
From: Ezra Peisach <epeisach@ATHENA.MIT.EDU>


Marc was trying to build moira off site. As a personal comment, before Marc
responds to Marc with the statement: "The moiradev tree is never guaranteed to
be stable except when noted."

	Ezra

------- Forwarded Message

Received: by E40-PO.MIT.EDU (5.45/4.7) id AA04727; Mon, 20 Aug 90 18:04:36 EDT
Received: from MIT.MIT.EDU by ATHENA.MIT.EDU with SMTP
	id AA24296; Mon, 20 Aug 90 18:04:28 EDT
Received: from BEEBLEBROX.MIT.EDU by MIT.EDU with SMTP
	id AA26536; Mon, 20 Aug 90 18:05:13 EDT
From: marc@MIT.EDU
Received: by beeblebrox.MIT.EDU (5.61/4.7) id AA21021; Mon, 20 Aug 90 18:04:19 -0400
Message-Id: <9008202204.AA21021@beeblebrox.MIT.EDU>
To: bugs@ATHENA.MIT.EDU
Subject: vax 7.1D: moira
Date: Mon, 20 Aug 90 18:04:15 EDT

System name:		beeblebrox
Type and version:	CVAXSTAR 7.1D (3 update(s) to same version)
Display type:		SM

What were you trying to do?
	build moira off-site

What's wrong:
	there are static buffers which are far too small.  I ran into it
	in src/gen/nfs.qc (/mit/moiradev in Athena's tree).  On line
	284:

    char file[64], f1[64], f2[64], *cp, *index();

	64 characters is far too small for a pathname.  In my case, f2
was exactly 64 characters long, so the first char of f1 was overlaid
by a \0, making the bug even more subtle.  Needless to say, the link()
call later in the function returned an error. returned an error.

What should have happened:
	Every place a static buffer for a filename is allocated, it
should be MAX_PATH bytes long.  In nfs.qc, static buffers are used for
sprintf targets for system() commands, as well.  For example:

    if (argc == 2) {
	sprintf(cmd, "cd %s; cp %s/nfs/* .; tar cf %s .",
		nfs_dir, SMS_DIR, argv[1]);
	if (system(cmd))
	  exit(MR_TAR_FAIL);
    }

Out the the 64 characters allocated for cmd, 28 are already used, 32
if you look at how nfs_dir is created.  This leaves 32 characters
(total!) for DCM_DIR, SMS_DIR, and argv[1].  At athena, DCM_DIR and
SMS_DIR are 10 bytes and 6 bytes.  argv[1] is "nfs.out", 7 chars.
This leaves sites 9 whole characters for larger filenames.  I'd
recommend that cmd be at least PATH_MAX+30 bytes long.

Also, there might be some problems with empty loops in nfs.qc.  every
occurrence of fclose(fd) in do_machs should check that fd != stdin.
mar will know what I mean here.

Please describe any relevant documentation references:
	Use the Force, Read the Source

------- End of Forwarded Message


home help back first fref pref prev next nref lref last post