<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>List of useful security libraries</title><link>http://blogs.msdn.com/michael_howard/archive/2006/02/27/540123.aspx</link><description>I was asked last week for a list of "drop-in-and-more-secure" replacements, created at Microsoft, for C/C++ functions and constructs. So here's a list: IntSafe (C safe integer arith library) SafeInt (C++ safe integer arith template class) Secure CRT (C</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Kernel Mustard  &amp;raquo; Blog Archive   &amp;raquo; More security libraries</title><link>http://blogs.msdn.com/michael_howard/archive/2006/02/27/540123.aspx#540148</link><pubDate>Tue, 28 Feb 2006 00:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:540148</guid><dc:creator>Kernel Mustard  » Blog Archive   » More security libraries</dc:creator><description>PingBack from &lt;a rel="nofollow" target="_new" href="http://kernelmustard.com/2006/02/27/more-security-libraries/"&gt;http://kernelmustard.com/2006/02/27/more-security-libraries/&lt;/a&gt;</description></item><item><title>re: List of useful security libraries</title><link>http://blogs.msdn.com/michael_howard/archive/2006/02/27/540123.aspx#540498</link><pubDate>Tue, 28 Feb 2006 14:29:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:540498</guid><dc:creator>James</dc:creator><description>That SafeInt class template (not template class) has got to be the worst bit of C++ I've seen in a while. Didn't that guy read Effective C++ or myriad other things? There's got to be something unsafe about bypassing the short-circuit evaluation for logical operators. The author doesn't justify his suspect choices, so I'll assume he doesn't know what he's doing.&lt;br&gt;</description></item><item><title>re: List of useful security libraries</title><link>http://blogs.msdn.com/michael_howard/archive/2006/02/27/540123.aspx#562219</link><pubDate>Mon, 27 Mar 2006 21:33:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:562219</guid><dc:creator>David LeBlanc</dc:creator><description>BTW, Michael should have posted the link to the 2.0 version of the class, which is a fair bit cleaner, and is also posted on MSDN.&lt;br&gt;&lt;br&gt;There is something unsafe about bypassing short-circuit evaluation for logical operators. But if you're going to pass a SafeInt to something that needs a bool, you're going to end up with this. It is one of the design trade-offs, and this one was considered very early on. The only time this will really bite you is in the case of:&lt;br&gt;&lt;br&gt;if(func() &amp;amp;&amp;amp; func2())&lt;br&gt;&lt;br&gt;where is isn't valid to call func2 unless func has succeeded. That's not a typical usage scenario for SafeInt, hence the design decision.&lt;br&gt;&lt;br&gt;There's several hundred lines of documentation and comments in the class - perhaps I missed that point.&lt;br&gt;&lt;br&gt;Funny you should mention Meyers' books - they're among my favorites, and Scott wrote me to let me know he really liked this class. If you take a look in the comments, you'll see where I made changes based on his input.</description></item><item><title>Corrected URLs</title><link>http://blogs.msdn.com/michael_howard/archive/2006/02/27/540123.aspx#562323</link><pubDate>Mon, 27 Mar 2006 23:30:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:562323</guid><dc:creator>David LeBlanc</dc:creator><description>The newer version of SafeInt (2.0), and the associated article is at &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncode/html/secure05052005.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncode/html/secure05052005.asp&lt;/a&gt;, and a direct link to the code is &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/library/en-us/dncode/html/secure05052005_sample.txt"&gt;http://msdn.microsoft.com/library/en-us/dncode/html/secure05052005_sample.txt&lt;/a&gt;&lt;br&gt;&lt;br&gt;BTW, an easy work-around to ensure short circuiting works as you want is to write clean code like so:&lt;br&gt;&lt;br&gt;Instead of:&lt;br&gt;&lt;br&gt;if(SafeInt&amp;lt;int&amp;gt;(x) &amp;amp;&amp;amp; SomeFunc())&lt;br&gt;&lt;br&gt;write:&lt;br&gt;&lt;br&gt;if(SafeInt&amp;lt;int&amp;gt;(x) != 0 &amp;amp;&amp;amp; SomeFunc())&lt;br&gt;&lt;br&gt;This is nicer, more readable code, and the != operator does return a bool, this the &amp;amp;&amp;amp; operator then works exactly as you expect. Another work-around would be to do this:&lt;br&gt;&lt;br&gt;if((bool)SafeInt&amp;lt;int&amp;gt;(x) &amp;amp;&amp;amp; SomeFunc())&lt;br&gt;&lt;br&gt;My personal opinion is that if you write code that depends on short-circuiting to work correctly without side-effects, you'll find that others will have a hard time maintaining your code. &lt;br&gt;&lt;br&gt;YMMV.&lt;br&gt;</description></item><item><title>Windows Vista Security – A Bigger Picture</title><link>http://blogs.msdn.com/michael_howard/archive/2006/02/27/540123.aspx#628212</link><pubDate>Mon, 12 Jun 2006 17:44:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:628212</guid><dc:creator>Michael Howard's Web Log</dc:creator><description>A couple of people have asked about the relationship between /GS, SAL and ASLR in Windows Vista. Here’s...</description></item><item><title>Soci blog  &amp;raquo; Blog Archive   &amp;raquo; Az elm??lt h??t tanuls??gai</title><link>http://blogs.msdn.com/michael_howard/archive/2006/02/27/540123.aspx#655254</link><pubDate>Mon, 03 Jul 2006 17:07:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:655254</guid><dc:creator>Soci blog  » Blog Archive   » Az elm??lt h??t tanuls??gai</dc:creator><description>PingBack from &lt;a rel="nofollow" target="_new" href="http://soci.hu/blog/index.php/2006/07/03/az-elmult-het-tanulsagai/"&gt;http://soci.hu/blog/index.php/2006/07/03/az-elmult-het-tanulsagai/&lt;/a&gt;</description></item><item><title>Librerie sicure per C e C++ &amp;laquo; Satius est supervacua scire</title><link>http://blogs.msdn.com/michael_howard/archive/2006/02/27/540123.aspx#8351725</link><pubDate>Wed, 02 Apr 2008 18:57:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8351725</guid><dc:creator>Librerie sicure per C e C++ « Satius est supervacua scire</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://manuel91.wordpress.com/2008/04/02/librerie-sicure-per-c-e-c/"&gt;http://manuel91.wordpress.com/2008/04/02/librerie-sicure-per-c-e-c/&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>