Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jul 1998 11:26:52 +0200
From:      "IBS / Andre Oppermann" <andre@pipeline.ch>
To:        Jos Backus <Jos.Backus@nl.origin-it.com>
Cc:        chat@FreeBSD.ORG
Subject:   Re: Let's close the door to "stack hacks"
Message-ID:  <35B30D5C.D0D0B8E2@pipeline.ch>
References:  <199807171948.NAA19746@lariat.lariat.org> <19980720105847.A2509@mpn.cp.philips.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Jos Backus wrote:
> 
> As an aside, I believe this is one of the reasons Dan Bernstein (of qmail
> fame) uses his own routines to do file/char/string/memops instead of those
> provided by libc.

Yea, but it's really hard to read it in the beginning. He uses always a
structure containing the data and the length. All return values are
checked, at least 70% of the 'if' statements are for error checking.

Sometimes he does really fancy things with it; eg. he builds up a
'structure' with "string1"NULL"string2"NULL"string3" and the length
of it. First he does "x = structure" to assign the first part of the
'structure' and after that he scans for NULL until he reaches the end
indicated by length. This works and is perfectly legal in C, but a
little
bit obfuscated and very hard to read and understand (and he doesn't
comment his code). BTW, he had won the 'Best of Show award' of the
'International Obfuscated C Code Contest' back in 1991. I think he
hasn't really recovered from that...
(http://reality.sgi.com/csp/ioccc/years.html#1991_brnstnd)

BTW, the 1998 contest is looking for judges, I think the FreeBSD
community has enough high profile C jugglers to get the whole
contest... ;-) In case you are interested, mailto judges@toad.com.
(http://reality.sgi.com/csp/ioccc/news/24jun98.html)

-- 
Andre Oppermann

CEO / Geschaeftsfuehrer
Internet Business Solutions Ltd. (AG)
Hardstrasse 235, 8005 Zurich, Switzerland
Fon +41 1 277 75 75 / Fax +41 1 277 75 77
http://www.pipeline.ch    ibs@pipeline.ch

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35B30D5C.D0D0B8E2>