Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 May 2001 23:45:45 -0400 (EDT)
From:      "Andrew R. Reiter" <arr@watson.org>
To:        freebsd-audit@freebsd.org
Subject:   audit work:  cmds.c from timedc
Message-ID:  <Pine.NEB.3.96L.1010508234228.79826A-200000@fledge.watson.org>

next in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--0-575651080-989379945=:79826
Content-Type: TEXT/PLAIN; charset=US-ASCII

Hey,

The attached patch accounts for a few sync ups to openbsd... they are:

	- check the msg.tsp_type value prior to using it as an 
	  index into char *tsptype[] 
	- use strlcpy's instead of strcpy's
	- & handle short packets properly.

The patch can also be found at:
http://www.watson.org/~arr/fbsd-audit/usr.sbin/timed/timedc/

comments appreciated

Thanks,

Andrew

*-------------.................................................
| Andrew R. Reiter 
| arr@fledge.watson.org
| "It requires a very unusual mind
|   to undertake the analysis of the obvious" -- A.N. Whitehead

--0-575651080-989379945=:79826
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="cmds.c.05082001.diff"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.NEB.3.96L.1010508234545.79826B@fledge.watson.org>
Content-Description: 

LS0tIGNtZHMuYy5vcmlnCVR1ZSBNYXkgIDggMTk6NTI6MzggMjAwMQ0KKysr
IGNtZHMuYwlUdWUgTWF5ICA4IDIwOjQwOjQwIDIwMDENCkBAIC0yNzcsNyAr
Mjc3LDcgQEANCiAJZmRfc2V0IHJlYWR5Ow0KIAlzdHJ1Y3Qgc29ja2FkZHJf
aW4gZGVzdDsNCiAJaW50IGksIGxlbmd0aDsNCi0Jc3RydWN0IHNvY2thZGRy
IGZyb207DQorCXN0cnVjdCBzb2NrYWRkcl9pbiBmcm9tOw0KIAlzdHJ1Y3Qg
dGltZXZhbCB0b3V0Ow0KIAlzdHJ1Y3QgdHNwIG1zZzsNCiAJc3RydWN0IHNl
cnZlb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JyLCAi
c2hvcnQgcGFjayAoJXUvJXUgYnl0ZXMpIGZyb20gJXNcbiIsDQorCQkJICAg
Y2MsIHNpemVvZihzdHJ1Y3QgdHNwKSwgaW5ldF9udG9hKGZyb20uc2luX2Fk
ZHIpKTsNCisJCQlyZXR1cm47DQorCQl9DQogCQlieXRlaG9zdG9yZGVyKCZt
c2cpOw0KIAkJaWYgKG1zZy50c3BfdHlwZSA9PSBUU1BfQUNLKQ0KIAkJCWlm
IChvbmZsYWcpDQogCQkJCXByaW50ZigidGltZWQgdHJhY2luZyBlbmFibGVk
XG4iKTsNCiAJCQllbHNlDQogCQkJCXByaW50ZigidGltZWQgdHJhY2luZyBk
aXNhYmxlZFxuIik7DQotCQllbHNlDQotCQkJcHJpbnRmKCJ3cm9uZyBhY2sg
cmVjZWl2ZWQ6ICVzXG4iLA0KKwkJZWxzZSB7DQorCQkJaWYgKG1zZy50c3Bf
dHlwZSA+PSBUU1BUWVBFTlVNQkVSKQ0KKwkJCQlwcmludGYoInVua25vd24g
YWNrIHJlY2VpdmVkOiAldVxuIiwNCisJCQkJCW1zZy50c3BfdHlwZSk7DQor
CQkJZWxzZQkNCisJCQkJcHJpbnRmKCJ3cm9uZyBhY2sgcmVjZWl2ZWQ6ICVz
XG4iLA0KIAkJCQkJCXRzcHR5cGVbbXNnLnRzcF90eXBlXSk7DQorCQl9DQog
CX0gZWxzZQ0KIAkJcHJpbnRmKCJjb21tdW5pY2F0aW9uIGVycm9yXG4iKTsN
CiB9DQo=
--0-575651080-989379945=:79826--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1010508234228.79826A-200000>