<?xml version="1.0" encoding="utf-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Sloppy systems programming</title>
	<link>http://www.zabbo.net/post/sloppy-systems-programming/</link>
	<description>software princess</description>
	<pubDate>Mon, 08 Sep 2008 12:49:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Adam S</title>
		<link>http://www.zabbo.net/post/sloppy-systems-programming/#comment-108</link>
		<dc:creator>Adam S</dc:creator>
		<pubDate>Sun, 01 May 2005 15:43:10 +0000</pubDate>
		<guid>http://www.zabbo.net/post/sloppy-systems-programming/#comment-108</guid>
		<description>Bad URL above, which Peter gave me while doing some updates.  The correct link is http://www.cs.auckland.ac.nz/~pgut001/cryptlib/</description>
		<content:encoded><![CDATA[<p>Bad URL above, which Peter gave me while doing some updates.  The correct link is <a href="http://www.cs.auckland.ac.nz/~pgut001/cryptlib/" rel="nofollow">http://www.cs.auckland.ac.nz/~pgut001/cryptlib/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Walsh</title>
		<link>http://www.zabbo.net/post/sloppy-systems-programming/#comment-107</link>
		<dc:creator>Chris Walsh</dc:creator>
		<pubDate>Sun, 01 May 2005 00:05:40 +0000</pubDate>
		<guid>http://www.zabbo.net/post/sloppy-systems-programming/#comment-107</guid>
		<description>What is more awful, IMO, is that it says stat(2) failed, when it actually called lstat(2)!
I don't know what log_err() does, but (again, IMO) failing and not saying why (perror() or "ARRRGH! Symlink detected!") sucks.  


BTW, I suspect that it refuses to follow the symlink in order to avoid a race condition (but nonetheless the existing code is still vulnerable to one).   Misleading diagnostic output is never acceptable, however.  It looks like they may originally have used stat(2) and then modified the code, but not the diagnostic output.  Sloppy.</description>
		<content:encoded><![CDATA[<p>What is more awful, IMO, is that it says stat(2) failed, when it actually called lstat(2)!<br />
I don&#8217;t know what log_err() does, but (again, IMO) failing and not saying why (perror() or &#8220;ARRRGH! Symlink detected!&#8221;) sucks.  </p>
<p>BTW, I suspect that it refuses to follow the symlink in order to avoid a race condition (but nonetheless the existing code is still vulnerable to one).   Misleading diagnostic output is never acceptable, however.  It looks like they may originally have used stat(2) and then modified the code, but not the diagnostic output.  Sloppy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam S</title>
		<link>http://www.zabbo.net/post/sloppy-systems-programming/#comment-106</link>
		<dc:creator>Adam S</dc:creator>
		<pubDate>Sat, 30 Apr 2005 17:19:14 +0000</pubDate>
		<guid>http://www.zabbo.net/post/sloppy-systems-programming/#comment-106</guid>
		<description>&lt;em&gt;
It apparently decides that this is fatal, because it knows more about the security trade-offs of your environment than you do, and that when it sees this policy violation it will fail and lie to you about why it failed.
&lt;/em&gt;
Hi Zach!

First let me say, I'm in complete and total agreement with your analysis of why this is the wrong way to handle the issue of stat'ing a link.  But as a security weenie, I recognize where the authors were coming from:  Stating links is dangerous.  The right fix, however is neither to die, nor to lie in your errors, but open the file, then stat the file descriptor.   Peter Guttmann maintains code to safely open files in C, at http://www.cypherpunks.to/~peter/snapshot.zip in io/file.c   So you dont even have to do the hard work.  Now if only he'd chmod it properly. ;)</description>
		<content:encoded><![CDATA[<p><em><br />
It apparently decides that this is fatal, because it knows more about the security trade-offs of your environment than you do, and that when it sees this policy violation it will fail and lie to you about why it failed.<br />
</em><br />
Hi Zach!</p>
<p>First let me say, I&#8217;m in complete and total agreement with your analysis of why this is the wrong way to handle the issue of stat&#8217;ing a link.  But as a security weenie, I recognize where the authors were coming from:  Stating links is dangerous.  The right fix, however is neither to die, nor to lie in your errors, but open the file, then stat the file descriptor.   Peter Guttmann maintains code to safely open files in C, at <a href="http://www.cypherpunks.to/~peter/snapshot.zip" rel="nofollow">http://www.cypherpunks.to/~peter/snapshot.zip</a> in io/file.c   So you dont even have to do the hard work.  Now if only he&#8217;d chmod it properly. ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: boolean</title>
		<link>http://www.zabbo.net/post/sloppy-systems-programming/#comment-52</link>
		<dc:creator>boolean</dc:creator>
		<pubDate>Fri, 11 Feb 2005 14:17:32 +0000</pubDate>
		<guid>http://www.zabbo.net/post/sloppy-systems-programming/#comment-52</guid>
		<description>pps, (and sorry for the double post) I should say that programmers in general seem to like dense lines of code - not just C coders. The good ones will at least try to make them readable. This is not a slam, but ties in nicely with Malcolm's assertion that "Programmers are Lazy".

rob</description>
		<content:encoded><![CDATA[<p>pps, (and sorry for the double post) I should say that programmers in general seem to like dense lines of code - not just C coders. The good ones will at least try to make them readable. This is not a slam, but ties in nicely with Malcolm&#8217;s assertion that &#8220;Programmers are Lazy&#8221;.</p>
<p>rob</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: boolean</title>
		<link>http://www.zabbo.net/post/sloppy-systems-programming/#comment-51</link>
		<dc:creator>boolean</dc:creator>
		<pubDate>Fri, 11 Feb 2005 13:06:19 +0000</pubDate>
		<guid>http://www.zabbo.net/post/sloppy-systems-programming/#comment-51</guid>
		<description>Part of the problem is the tendency for C programmers to embed as much on a line as possible. Especially for failure conditions. Something I've forced myself to do over the past couple of years is include a separate test and exit for all failure conditions. I do this partly because of the ugliness of nesting conditionals in Smalltalk, but I've also found that it has a side-effect of more detailed failures.

ok, make fun of the smalltalker now.

ps, hi zab!</description>
		<content:encoded><![CDATA[<p>Part of the problem is the tendency for C programmers to embed as much on a line as possible. Especially for failure conditions. Something I&#8217;ve forced myself to do over the past couple of years is include a separate test and exit for all failure conditions. I do this partly because of the ugliness of nesting conditionals in Smalltalk, but I&#8217;ve also found that it has a side-effect of more detailed failures.</p>
<p>ok, make fun of the smalltalker now.</p>
<p>ps, hi zab!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://www.zabbo.net/post/sloppy-systems-programming/#comment-50</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Thu, 10 Feb 2005 21:08:08 +0000</pubDate>
		<guid>http://www.zabbo.net/post/sloppy-systems-programming/#comment-50</guid>
		<description>I just had the exact same problem, exact same context -trying to install cricket.  Thank you for saving me some of the frustration you went through.

-peter</description>
		<content:encoded><![CDATA[<p>I just had the exact same problem, exact same context -trying to install cricket.  Thank you for saving me some of the frustration you went through.</p>
<p>-peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Malcolm</title>
		<link>http://www.zabbo.net/post/sloppy-systems-programming/#comment-46</link>
		<dc:creator>Malcolm</dc:creator>
		<pubDate>Mon, 31 Jan 2005 22:36:54 +0000</pubDate>
		<guid>http://www.zabbo.net/post/sloppy-systems-programming/#comment-46</guid>
		<description>Certainly true.  As someone who gets called when this sort of thing happens, it infuriates me sometimes how frequently I have to fire up a debugger or use some sort of tracer to find out what's really going on, when I simple descriptive error message would do the trick.  

I think of this as the "theory of relative locative density of work".  For any given decision about how something should break, programmers tend to see the amount of work that they will have to do, compared to the amount of work I will have to do, as being not worth their time to fix.  It's harder for them to add an extra line or two of code to print a reasonable, accurate error message than it is for me to reverse engineer what happened.  I used to think that this was because programmers were Gods who thought "of course, people will just look at the source and see this obvious thing", but now I realize that it's because programmers, as a group, are lazy, undisciplined nitwits.  

M</description>
		<content:encoded><![CDATA[<p>Certainly true.  As someone who gets called when this sort of thing happens, it infuriates me sometimes how frequently I have to fire up a debugger or use some sort of tracer to find out what&#8217;s really going on, when I simple descriptive error message would do the trick.  </p>
<p>I think of this as the &#8220;theory of relative locative density of work&#8221;.  For any given decision about how something should break, programmers tend to see the amount of work that they will have to do, compared to the amount of work I will have to do, as being not worth their time to fix.  It&#8217;s harder for them to add an extra line or two of code to print a reasonable, accurate error message than it is for me to reverse engineer what happened.  I used to think that this was because programmers were Gods who thought &#8220;of course, people will just look at the source and see this obvious thing&#8221;, but now I realize that it&#8217;s because programmers, as a group, are lazy, undisciplined nitwits.  </p>
<p>M</p>
]]></content:encoded>
	</item>
</channel>
</rss>
