<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SIGTTOU &#187; Microsoft</title>
	<atom:link href="http://sigttou.com/category/microsoft/feed" rel="self" type="application/rss+xml" />
	<link>http://sigttou.com</link>
	<description>Just another background process...</description>
	<lastBuildDate>Sun, 04 Jul 2010 02:08:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Compiling Lua with Visual Studio 2010</title>
		<link>http://sigttou.com/lua-visual-studio-2010-2</link>
		<comments>http://sigttou.com/lua-visual-studio-2010-2#comments</comments>
		<pubDate>Tue, 04 May 2010 06:03:15 +0000</pubDate>
		<dc:creator>Bob Somers</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://sigttou.com/?p=193</guid>
		<description><![CDATA[It&#8217;s not often I have to venture into the Microsoftland development environment, but when I do it always seems to take me a while to get used to their visual projects instead of good &#8216;ole Makefiles. I&#8217;ve been using Lua &#8230; <a href="http://sigttou.com/lua-visual-studio-2010-2">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not often I have to venture into the Microsoftland development environment, but when I do it always seems to take me a while to get used to their visual projects instead of good &#8216;ole Makefiles. I&#8217;ve been using Lua to extend my C and C++ apps a lot recently, so I suddenly found myself needing to include the Lua static library with a Visual Studio 2010 project.</p>
<p>There are already binary distributions out there, but I like to compile things myself, so I whipped up a Visual Studio 2010 project to compile the Lua static library (<code>lua.lib</code>) the command line interpreter (<code>lua.exe</code>) and the script compiler (<code>luac.exe</code>).</p>
<p>First things first. If you just want a zip file with those three binary files (the library is Visual Studio 2010 compatible), look no further:</p>
<ul>
<li><a href="http://sigttou.com/files/lua-5.1.4-bin-vs2010.zip">Lua 5.1.4 binaries compiled with VS 2010</a> (<code>lua</code>, <code>luac</code>, <code>lua.lib</code>, and necessary headers)</li>
</ul>
<p>If you want to build Lua 5.1.4 yourself (like me) just grab the most recent copy of the 5.1.4 source code from the <a href="http://www.lua.org">Lua website</a>. Next, grab these Visual Studio 2010 project files and solution file:</p>
<ul>
<li><a href="http://sigttou.com/files/lua-5.1.4-proj-vs2010.zip">Lua 5.1.4 Visual Studio 2010 projects</a> (to build the binaries yourself)</li>
</ul>
<p>To use the project files, just unzip them into the root directory of your Lua source files (where the <code>README</code>, <code>INSTALL</code>, and <code>COPYRIGHT</code> files are). Then, load up <code>lua-vs2010.sln</code> in Visual Studio 2010. You should see three projects. The first, <code>lualib</code> will build the static library under <code>lib/lua.lib</code>. The second and third, <code>lua</code> and <code>luac</code> will build the Lua interpreter and compiler under <code>bin/lua.exe</code> and <code>bin/luac.exe</code>.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://sigttou.com/lua-visual-studio-2010-2/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ban programmers, not functions</title>
		<link>http://sigttou.com/ban-programmers-not-functions</link>
		<comments>http://sigttou.com/ban-programmers-not-functions#comments</comments>
		<pubDate>Tue, 07 Jul 2009 19:35:16 +0000</pubDate>
		<dc:creator>Bob Somers</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://sigttou.com/?p=71</guid>
		<description><![CDATA[So my daily travels around the intertubes landed me on a very interesting blog post by Microsoft&#8217;s Security Development Lifecycle team (which they call SDL, not to be confused with the arguably more useful Simple DirectMedia Layer library). The post &#8230; <a href="http://sigttou.com/ban-programmers-not-functions">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So my daily travels around the intertubes landed me on a very interesting <a href="http://blogs.msdn.com/sdl/archive/2009/05/14/please-join-me-in-welcoming-memcpy-to-the-sdl-rogues-gallery.aspx">blog post by Microsoft&#8217;s Security Development Lifecycle team</a> (which they call SDL, not to be confused with the arguably more useful <a href="http://www.libsdl.org/">Simple DirectMedia Layer</a> library). The post centered around them adding <code class="prettyprint">memcpy()</code> to the banned functions list in favor of their more &#8220;secure&#8221; variant, <code class="prettyprint">memcpy_s()</code>, which takes and checks the size of the destination buffer.</p>
<p>Before I explain why I think this is another example of Microsoft spending their time doing something incredibly useless instead of innovating, let me explain that all these blasted <code class="prettyprint">_s</code> functions are one of the reasons I detest the Windows API so much.</p>
<p>I had the unfortunate &#8220;pleasure&#8221; of digging rather deep into the Windows API for a project I was working on this past spring quarter. For those of you who haven&#8217;t ventured into the Windows API, let me say this: It&#8217;s so incredibly confusing that it doesn&#8217;t even look like C anymore.</p>
<p>Almost everything uses custom types, even when there&#8217;s no logical reason to do so. The Linux API does this to some extent, but not nearly as bad as Microsoft.</p>
<p>Secondly, there seems to be no rhyme or reason as to what these types are named. Some are named as <code class="prettyprint">ALL_CAPITALS_TYPE</code>, others <code class="prettyprint">_use_this_strange_underscore_prefix</code>, and some use the standard <code class="prettyprint">type_t</code>. If you start to use almost any standard library C function, you&#8217;ll inevitably be told by the compiler that you&#8217;re doing it wrong, and should use <code class="prettyprint">strcpy_s()</code>, or <code class="prettyprint">_strcpy_s()</code>, or <code class="prettyprint">_s_t_r_c_p_y_s_()</code>. Seriously, their API has got more underscores than Bill Gates has dollar bills.</p>
<p>What this gives you is this strange, alien language that vaguely resembles C, but is so ugly and hideous that you&#8217;re afraid to touch it. Apple has Objective-C. Microsoft has Franken-C.</p>
<p>So let me back up and explain this blog post I mentioned earlier. I&#8217;m a bit behind on this one (I&#8217;ll admit I&#8217;m not often found venturing into the MSDN blogs) but back in May the SDL announced that they were adding <code class="prettyprint">memcpy()</code> to their banned functions list, to join <code class="prettyprint">strcpy()</code>, <code class="prettyprint">strcat()</code>, <code class="prettyprint">strncpy()</code>, <code class="prettyprint">strncat()</code>, <code class="prettyprint">gets()</code>, and others.</p>
<p>They announced it&#8217;s replacement, <code class="prettyprint">memcpy_s()</code> (soon to be replaced by <code class="prettyprint">_memcpy_s()</code> and <code class="prettyprint">_m_e_m_c_p_y_s_()</code> I&#8217;m sure), which takes one additional argument: the size of the destination buffer.</p>
<p>This is aimed make usages of <code class="prettyprint">memcpy()</code> more secure, by only copying up to the size of the destination buffer bytes, even if that&#8217;s less than the length of the bytes you want to copy. You go from using this:</p>
<pre class="prettyprint">memcpy(dst, src, len);</pre>
<p>to using this:</p>
<pre class="prettyprint">memcpy_s(dst, sizeof(dst), src, len);</pre>
<p>This sounds reasonable, except most Windows programmers will just do this:</p>
<pre class="prettyprint">memcpy_s(dst, len, src, len);</pre>
<p>which makes your &#8220;secure&#8221; version useless.</p>
<p>The problem here is not that <code class="prettyprint">memcpy()</code> doesn&#8217;t check the size of the destination buffer, but rather that some programmers are using it without thinking. A 50 caliber sniper rifle is a very powerful tool in the hands of a marksman, but in a cage full of chimpanzees, the results could be disastrous.</p>
<blockquote><p>If nothing else, memcpy_s() makes you think about the size of the target buffer.</p></blockquote>
<p>I suppose, unless you&#8217;re one of the mindless programmers using <code class="prettyprint">memcpy()</code> unsafely before, in which case you&#8217;ll learn the new and improved mindless version <code class="prettyprint">memcpy_s(dst, len, src, len)</code> and continue on your merry way.</p>
<p>My point here is that banning functions that are the common source of security vulnerabilities doesn&#8217;t fix the problem, because the problem isn&#8217;t with the functions. These functions are well documented and we know exactly how they work and what their dangers are. <strong>The problem is with the programmers.</strong></p>
<p>You&#8217;ve got to teach your programmers how to use these functions securely, or at least evaluate when they should ask for someone to review their code. If training isn&#8217;t an option, there&#8217;s a better option than banning these functions.</p>
<p><strong>Ban programmers who use them wrong.</strong> Yes, banish them to the land of C# and other fluffy dynamic languages with garbage collectors and infinite buffers. They&#8217;ll do far less harm there.</p>
<p>The key to doing memory management correctly (which includes using <code class="prettyprint">memcpy()</code>, <code class="prettyprint">strcpy()</code>, etc. in safe ways) is to completely engage your brain when you&#8217;re doing it. <strong>You cannot zone out when writing memory managing code.</strong> Although given the quality of code coming out of Redmond, I would not be surprised if most of the programmers have their brains permanently switched off.</p>
<p>As classic-Microsoft as this blog post was, the best line was last one.</p>
<blockquote><p>I wonder when Larry, Steve and Linus will start banning strcpy() in their products?</p></blockquote>
<p>Words cannot express the hilarity that ensued when I read this line. Maybe, just maybe, the reason they haven&#8217;t found the need to ban them is because <strong>they&#8217;re using them correctly.</strong> Perhaps if Microsoft tried that every once in a while, they would churn out more secure products themselves without having to resort to Franken-C.</p>
]]></content:encoded>
			<wfw:commentRss>http://sigttou.com/ban-programmers-not-functions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
