<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>&gt;kloctalk</title>
	
	<link>http://www.klocwork.com/blog</link>
	<description>&gt;kloctalk is a blog and a community for software development professionals who create and maintain mission-critical software and the challenges they face on a daily basis.</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:45:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Kloctalk_blog" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="kloctalk_blog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">Kloctalk_blog</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Answering questions about your code base – Part 1</title>
		<link>http://www.klocwork.com/blog/2012/02/answering-questions-about-your-code-base-part-1/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=answering-questions-about-your-code-base-part-1</link>
		<comments>http://www.klocwork.com/blog/2012/02/answering-questions-about-your-code-base-part-1/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 13:45:32 +0000</pubDate>
		<dc:creator>Patti Murphy</dc:creator>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Software Quality]]></category>
		<category><![CDATA[Static Analysis]]></category>
		<category><![CDATA[source code analysis]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1444</guid>
		<description><![CDATA[Static analysis captures the current state of your code base and helps you answer key questions about the quality, security and maintainability of your software project. Think Magic 8 Ball with build omniscience and powerful reporting tools. OK, maybe Magic 8 Ball isn&#8217;t a good analogy. Answers to what questions, you ask? One we often [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2012/02/Magic8ball_x.jpg"><img class="alignright size-full wp-image-1445" title="Magic8ball_x" src="http://www.klocwork.com/blog/wp-content/uploads/2012/02/Magic8ball_x.jpg" alt="" width="203" height="203" /></a>Static analysis captures the current state of your code base and helps you answer key questions about the quality, security and maintainability of your software project.</p>
<p>Think Magic 8 Ball with build omniscience and powerful reporting tools. OK, maybe Magic 8 Ball isn&#8217;t a good analogy.</p>
<p>Answers to what questions, you ask? One we often hear from customers is: <strong>Where do I start?</strong></p>
<p>A good place to start is a report that captures the distribution of defect types from your current build.  For example, we recommend that our customers glance over the Top 10 Issues report in our web-based build reporting tool, <a href="http://www.youtube.com/watch?feature=player_embedded&amp;list=PL1A2FCC17F8F213D5&amp;v=G20amVkXw0g" target="_blank">Klocwork Review</a> while indulging in their morning cup of coffee:</p>
<div id="attachment_1447" class="wp-caption aligncenter" style="width: 624px"><a href="http://www.klocwork.com/blog/wp-content/uploads/2012/02/top10-21.png"><img class="size-full wp-image-1447 " title="top10-2" src="http://www.klocwork.com/blog/wp-content/uploads/2012/02/top10-21.png" alt="" width="614" height="505" /></a><p class="wp-caption-text">Magic 8 Ball can&#39;t do this. Here&#39;s a defect distrubtion view of your build.</p></div>
<p>With this build snapshot and your caffeine jolt,  you can quickly identify defects of interest to your organization, such as null pointer dereferences and memory leaks. If you wish, you can set up filters (we call <a href="http://www.klocwork.com/products/documentation/current/Customizing_your_view_of_the_integration_build_analysis" target="_blank">views</a>) to show only these defect types in your report.</p>
<p>Your next step is to get your developers using static analysis on their desktops to prevent the injection of these high-priority defects into the build in the first place.</p>
<p>Once a policy of pre-checkin static analysis usage is put in place, pay attention to new defects injected into the build from that point on. If you see a spike in new defects, then investigate.</p>
<p>The magnitude of that y-axis is not what matters most; it&#8217;s the overall trend that counts.</p>
<p>For my next post, I&#8217;ll take a look at reports that track your cost of ownership and show you what success looks like.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2012/02/answering-questions-about-your-code-base-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Golden rules of AST checker development</title>
		<link>http://www.klocwork.com/blog/2012/01/golden-rules-of-ast-checker-development/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=golden-rules-of-ast-checker-development</link>
		<comments>http://www.klocwork.com/blog/2012/01/golden-rules-of-ast-checker-development/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 14:57:10 +0000</pubDate>
		<dc:creator>Patti Murphy</dc:creator>
				<category><![CDATA[Coding Standards]]></category>
		<category><![CDATA[General Coding]]></category>
		<category><![CDATA[Software Quality]]></category>
		<category><![CDATA[Static Analysis]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[coding standards]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[source code analysis]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1427</guid>
		<description><![CDATA[In my previous post, It&#8217;s time to create a custom checker&#8230;, we looked at the considerations involved in deciding which checker to create&#8211;AST or path? In this post, we&#8217;re going to use a custom checker to enforce an internal coding standard that extends the default set of checkers in our source code analysis tool. To [...]]]></description>
			<content:encoded><![CDATA[<p>In my previous post, <a href="http://www.klocwork.com/blog/2011/11/its-time-to-create-a-custom-checker-but-what-kind/" target="_blank">It&#8217;s time to create a custom checker&#8230;</a>, we looked at the considerations involved in deciding which checker to create&#8211;AST or path?</p>
<p>In this post, we&#8217;re going to use a custom checker to enforce an internal coding standard that extends the default set of checkers in our source code analysis tool.</p>
<p>To do this, I&#8217;ve called upon Steve Howard, our head of Partner Support in Europe, to get us started with an AST checker to accomplish our goal.</p>
<p>Steve has coached many customers through the checker creation process. In his experience, the appeal of custom checkers lies in their ability  to <a href="http://www.klocwork.com/blog/2011/01/in-standards-we-unite-in-agile-we-diverge/" target="_blank">enforce naming conventions and code constructions across organizations</a>.</p>
<p>The standard we want to enforce is the use of a compound statement block rather than single statements as the body of a <em>for loop</em>. An AST checker is the way to go because detection depends solely on the syntax of the code itself and not runtime behavior.</p>
<p>See the example below:</p>
<table>
</table>
<table cellspacing="5" cellpadding="2">
<tbody>
<tr>
<td><strong>Incorrect:</strong></td>
<td><strong>Correct:</strong></td>
</tr>
<tr>
<td>for( i &#8211; 0; i &lt; 10; i++ )<br />
 doSomething( );</td>
<td>for( i &#8211; 0; i &lt; 10; i++ ) {<br />
 doSomething();<br />
 }</td>
</tr>
</tbody>
</table>
<p>To flag this violation, we need to instruct the checker to find all instances of <em>for loop</em> nodes that contain a <em>Statement </em>node as an immediate descendant.</p>
<p>A tool that shows you a visual representation of the AST for the test case is quite helpful in the checker creation process. Here at Klocwork, we use <a href="http://www.klocwork.com/products/documentation/current/Tutorial_1_-_Introducing_Checker_Studio" target="_blank">Checker Studio</a> to:</p>
<ul>
<li>browse the AST structure of test cases,</li>
<li>identify nodes of interest, and </li>
<li>test XPath-like expressions that identify node types, qualifiers, conditions and variables to traverse the AST and flag the defect.</li>
</ul>
<p><strong>Note</strong>: If we wanted to enforce the compound statement rule in all loops, then we’d need to have one pattern (created using the XPath-like expression) for each possible kind, such as <em>while loops</em> and <em>do while  loops</em>.</p>
<p>Armed with the test case, Checker Studio, and a <a href="http://www.klocwork.com/products/documentation/current/All_about_C/C%2B%2B_KAST_expressions" target="_blank">syntax guide</a>, Steve identified the following expression that flags the infraction:</p>
<p>// ForStmt [not (Stmt::CompoundStmt)]</p>
<p>Here&#8217;s how the test case and expression appear in Checker Studio:</p>
<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2012/01/GoldenRules_Studio2.png"><img class="aligncenter size-full wp-image-1436" title="GoldenRules_Studio" src="http://www.klocwork.com/blog/wp-content/uploads/2012/01/GoldenRules_Studio2.png" alt="" width="623" height="516" /></a></p>
<p><strong>Golden rules</strong></p>
<p>Based on his experience, Steve has a number of golden rules that get you from idea to defect detection faster:</p>
<ul>
<li><strong>Start simple</strong>: Use a simple test case that contains the defect you want to detect and work with one simple pattern at a time. Add more complexity as you go along</li>
<li><strong>Start rough and refine later:</strong> Don&#8217;t worry about false positives at first. In some cases it may even be easier to search for  instances that are OK and then negate the rule at the end</li>
<li><strong>Divide and conquer:</strong> With a more complex checker, work separately on each aspect of the defect you want to detect and then bring it all together at the end for testing in Checker Studio</li>
<li><strong>Watch your levels:</strong> Make the highlighting as relevant as possible for the issue you&#8217;re trying to find. For example, “// ClassType [MemberDecls[*]::MemberDecl]” will highlight classes that match, whereas “// ClassType/MemberDecls[*]::MemberDecl”  will highlight class members that match. The rule is the same, but the focus is different</li>
<li><strong>Weed out false negatives:</strong> Add negative examples (good code) to check for false negatives</li>
</ul>
<p>For more information about our custom AST checkers, watch our <a href="http://www.klocwork.com/resources/video/tag/insight-9.5/static-analysis-custom-checkers/display" target="_blank">Checker Studio video</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2012/01/golden-rules-of-ast-checker-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It’s been a while since our last post, but we’ve been busy…</title>
		<link>http://www.klocwork.com/blog/2012/01/its-been-a-while-since-our-last-post-but-weve-been-busy/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=its-been-a-while-since-our-last-post-but-weve-been-busy</link>
		<comments>http://www.klocwork.com/blog/2012/01/its-been-a-while-since-our-last-post-but-weve-been-busy/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 16:54:31 +0000</pubDate>
		<dc:creator>Gwyn Fisher</dc:creator>
				<category><![CDATA[General Coding]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1430</guid>
		<description><![CDATA[So it&#8217;s that time again, when our team finally gets to sleep for a day or two and get their lives back in order. What am I talking about? Answer: Klocwork Insight 9.5 releases today and boy are we ever happy to see it go live &#8212; we&#8217;re &#8220;out there Jerry&#8221; and yes, of course [...]]]></description>
			<content:encoded><![CDATA[<p>So it&#8217;s that time again, when our team finally gets to sleep for a day or two and get their lives back in order. What am I talking about?</p>
<p>Answer: <a title="Klocwork Insight 9.5" href="http://www.klocwork.com/products/klocwork-insight-95-whats-new/">Klocwork Insight 9.5</a> releases today and boy are we ever happy to see it go live &#8212; we&#8217;re &#8220;out there Jerry&#8221; and yes, of course we&#8217;re loving every minute of it.</p>
<p>This has been a long release, taking significant research and development to bring to fruition, all the while continuing to release more traditional shipments as we went, but finally culminating in a new, game-changing technology for source code analysis. On-the-fly, as-you-type, instant-like-for-reals, call it what you like&#8230; full-on, in-depth C/C++ analysis performed as the developer enters their code, using the &#8220;squiggly line&#8221; usability metaphor created by spell checkers. It&#8217;s one of those &#8220;why would you do it any other way&#8221; moments and we&#8217;re happy to be unique.</p>
<p>Not to be outdone, our web tools team has done amazing stuff with a complete redesign of our Review and Inspect tools, showcasing an awesome look and feel that leverages the toys that come with HTML5 and, amongst many other new capabilities, brings drag/drop pivot report design to the web for on-the-fly metrics and trending analysis that managers and development leads will just eat up.</p>
<p>To our customers, our partners and our friends in the industry, we&#8217;d like to say Welcome to Insight 9.5, hope you enjoy it.</p>
<p><br class="spacer_" /></p>
<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2012/01/kw-insight.png"><img class="aligncenter size-full wp-image-1432" title="kw-insight" src="http://www.klocwork.com/blog/wp-content/uploads/2012/01/kw-insight.png" alt="Klocwork Insight Logo" width="450" height="79" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2012/01/its-been-a-while-since-our-last-post-but-weve-been-busy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It’s time to create a custom checker, but what kind?</title>
		<link>http://www.klocwork.com/blog/2011/11/its-time-to-create-a-custom-checker-but-what-kind/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=its-time-to-create-a-custom-checker-but-what-kind</link>
		<comments>http://www.klocwork.com/blog/2011/11/its-time-to-create-a-custom-checker-but-what-kind/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 14:56:15 +0000</pubDate>
		<dc:creator>Patti Murphy</dc:creator>
				<category><![CDATA[General Coding]]></category>
		<category><![CDATA[Static Analysis]]></category>
		<category><![CDATA[custom checkers]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1388</guid>
		<description><![CDATA[You&#8217;ve been using source code analysis on your integration build or your desktop, or (ideally) both. And then there&#8217;s &#8220;a situation&#8221;. The situation Either you: Noticed a false negative you want detected, or Need a way to enforce a corporate coding standard, such as the requirement for the use of  a compound statement block rather [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/09/checkers.gif"><img class="alignright size-full wp-image-1390" title="checkers" src="http://www.klocwork.com/blog/wp-content/uploads/2011/09/checkers.gif" alt="" width="369" height="254" /></a></p>
<p>You&#8217;ve been using source code analysis on your integration build or your desktop, or (ideally) both. And then there&#8217;s &#8220;a situation&#8221;.</p>
<p><strong>The situation</strong></p>
<p>Either you:</p>
<ul>
<li>Noticed a false negative you want detected, or </li>
<li>Need a way to enforce a corporate coding standard, such as the requirement for the use of  a compound statement block rather than single statements as the body of a loop.</li>
</ul>
<p><strong>Now what?</strong></p>
<p>Time to create a custom checker, that&#8217;s what. But what kind of checker?</p>
<p>Source code analysis involves two families of checkers, those that involve:</p>
<ul>
<li>Abstract Syntax Tree (AST) validation, and </li>
<li>Code path analysis.</li>
</ul>
<p>An AST provides a tree-based structural representation of the source code. An AST checker allows you to pinpoint problematic syntax using XPath or XPath-derived grammar to define the problem you&#8217;re looking for. AST checkers (our version is called Klockwork AST checkers, or KAST for short) don&#8217;t require program execution to run; they detect defects right away on source code.</p>
<p>Code path analysis, on the other hand, targets defects related to value tracking at program execution time. Instead of style violations, you&#8217;d use a path checker to answer questions such as:</p>
<ul>
<li>Is this newly-created object released before all aliases to it are removed from scope?</li>
<li>Is this data object ever range-checked before being passed to an OS function?</li>
<li>Is this string checked for special characters before being submitted as an SQL query?</li>
</ul>
<p>To create a path checker, you don&#8217;t need to know how data is tracked by the checker. What you do need to know are the function types and values you want to track for the analysis starting point and the analysis end point where the defect (or event) is recognized and reported.</p>
<p><strong>Which checker when?</strong></p>
<p>Create an AST checker when the problem you want to detect:</p>
<ul>
<li>is a local defect</li>
<li>does not involve program execution</li>
<li>has to do with the way the program was written</li>
<li>does not involve tracking a value</li>
<li>does not involve a path</li>
</ul>
<p>Create a path checker when the problem you want to detect:</p>
<ul>
<li>involves tracking a value</li>
<li>has a starting point (where the analysis starts) and end point (where the defect is detected)</li>
<li>involves program execution</li>
</ul>
<p>Stay tuned for the next post in this series on best practices for AST checker creation.</p>
<p>For more information, see <a href="http://www.klocwork.com/products/documentation/current/Writing_custom_checkers_with_Klocwork_Extensibility" target="_blank">Writing custom checkers with Klocwork Extensibility</a> or check out our member discussions in the <a href="http://developer.klocwork.com/community/forums/customization/cc-checkers" target="_blank">C/C++ custom checkers forum</a>.</p>
<p><em>&#8211;With files from CTO Gwyn Fisher</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/11/its-time-to-create-a-custom-checker-but-what-kind/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Security Issues with Apple iOS?</title>
		<link>http://www.klocwork.com/blog/2011/11/security-issues-with-apple-ios/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=security-issues-with-apple-ios</link>
		<comments>http://www.klocwork.com/blog/2011/11/security-issues-with-apple-ios/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 18:01:04 +0000</pubDate>
		<dc:creator>Todd Landry</dc:creator>
				<category><![CDATA[General Coding]]></category>
		<category><![CDATA[Software Security]]></category>
		<category><![CDATA[software security]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1419</guid>
		<description><![CDATA[As a pretty avid Apple user (2 iPhones, 1 iPad2, iMac, iPod Touch, MacBook Pro, etc.), and the fact that I work in the business of software quality and security, I must admit that this article caught my attention. The article outlines how a well-known security researcher, who focuses on Apple, has found a software [...]]]></description>
			<content:encoded><![CDATA[<p>As a pretty avid Apple user (2 iPhones, 1 iPad2, iMac, iPod Touch, MacBook Pro, etc.), and the fact that I work in the business of software quality and security, I must admit that this <a href="http://ca.reuters.com/article/technologyNews/idCATRE7A708Q20111108">article</a> caught my attention. The article outlines how a well-known security researcher, who focuses on Apple, has found a software flaw in the iPhone and iPad, which could allow hackers to build malicious apps.What makes this even more scary is that the Apple Store may not catch these malicious apps.<a href="http://www.klocwork.com/blog/wp-content/uploads/2011/11/download.jpeg"><img class="alignright size-full wp-image-1422" title="download" src="http://www.klocwork.com/blog/wp-content/uploads/2011/11/download.jpeg" alt="" width="254" height="198" /></a></p>
<p>To add another twist to this story, the researcher in question has been ejected from participating in Apple&#8217;s developer programs. Read about that <a href="http://news.cnet.com/8301-27076_3-57320190-248/apple-boots-security-guru-who-exposed-iphone-exploit/">here</a>.</p>
<p>Are we now getting to the point where hackers are going to start trying more aggressively to exploit Apple products? In a <a href="http://news.cnet.com/8301-27080_3-10444561-245.html">survey</a> done in 2010, over 50% of respondents thought Windows was either &#8220;very&#8221; or &#8220;extremely&#8221; vulnerable compared to only 20% for Apple. I wonder if that has changed? More importantly, do I need to start worrying about my daughter downloading the Archie comic app from the App Store?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/11/security-issues-with-apple-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What’s the Right Iteration Length?</title>
		<link>http://www.klocwork.com/blog/2011/11/whats-the-right-iteration-length/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=whats-the-right-iteration-length</link>
		<comments>http://www.klocwork.com/blog/2011/11/whats-the-right-iteration-length/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 13:00:44 +0000</pubDate>
		<dc:creator>Todd Landry</dc:creator>
				<category><![CDATA[Agile Development]]></category>
		<category><![CDATA[General Coding]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1410</guid>
		<description><![CDATA[The question of &#8220;what&#8217;s the right iteration length&#8221; may not be as interesting as any of the questions found here (gum really doesn&#8217;t stay in you for 7 years. Who knew?), but it is a common question from organizations moving to agile development. You can certainly get a lot of different opinions on this from [...]]]></description>
			<content:encoded><![CDATA[<p>The question of &#8220;what&#8217;s the right iteration length&#8221; may not be as interesting as any of the questions found <a href="http://www.telegraph.co.uk/news/newstopics/howaboutthat/4696372/Greatest-101-questions-of-all-time-1-20.html">here</a> (gum really doesn&#8217;t stay in you for 7 years. Who knew?), but it is a common question from organizations moving to agile development. You can certainly get a lot of different <a href="http://www.mountaingoatsoftware.com/articles/30-selecting-the-right-iteration-length-for-your-software-development-process">opinions</a> on this from a Google search, but since you&#8217;re reading this now, I&#8217;ll give you mine, based on personal experience.</p>
<p>A number of years ago, one of the projects I was PM on decided to try out Scrum. I had attended some Product Owner <a href="http://www.mountaingoatsoftware.com/certified-product-owner-training">training</a>, and our soon-to-be Scrum Master had been on some training as well, but we were very green and decided to approach things with a &#8220;let&#8217;s see what works best for us&#8221; mentality. At the time, we thought the best way for us to get immersed and efficient with Scrum was lots of repetitions. We went with 1-week iterations, thinking that by having a rapid and regular cycle of sprint planning meetings, demo meetings, retrospective meetings, etc. we would learn more quickly the &#8220;proper&#8221; way of doing development with Scrum.</p>
<p>We certainly did learn a lot during our first 3 or 4 sprints, mainly that having this regular weekly cycle of meetings was just too much overhead, and the actual amount of value produced at the end of each sprint was too little. Next on our list, the 2-week sprint.<a href="http://www.klocwork.com/blog/wp-content/uploads/2011/10/monkey.jpeg"><img class="alignright size-full wp-image-1411" title="monkey" src="http://www.klocwork.com/blog/wp-content/uploads/2011/10/monkey.jpeg" alt="" width="259" height="194" /></a></p>
<p>The 2-week sprints worked great for us, and we saw the differences from the 1-week sprints almost immediately. We were producing what we thought was a good amount of value from each sprint, but with a better and more balanced level of overhead. We hit our groove and established a good cadence with these 2-week sprints, and from the looks of the burn-down chart, we were becoming a more efficient team with every sprint.</p>
<p>The team definitely was cruising and enjoying the pace, but the holiday season snuck up on us and we thought that it might make sense to make some adjustments to deal with the vacation time various team members would be taking.</p>
<p>After collecting everyone&#8217;s vacation schedule, we were able to determine a start and finish date for our &#8220;holiday sprint&#8221; that would essentially start when everyone was still in the office, and finish when everyone returned from their vacation. Call it either luck or good management, but we had planned a 4-week sprint. I won&#8217;t go through all the gory details, but let&#8217;s just say that upon reflection, the 4-week iteration just felt wrong.</p>
<p>The initial planning session felt harder to estimate the amount of work we could do. The cadence we developed didn&#8217;t show itself, and it really felt like we never gained any momentum during the 4 weeks. Now I&#8217;m sure that the whole holiday season thing played a role in this, but it was our least effective iteration ever, and by a lot. We never tried the 4-week iteration again.</p>
<p>The bottom line is that all teams are different and need to go with the iteration length that feels right for them. For us, the 2-week one was best.</p>
<p>For the record, I have always wondered if the 7-year rule for chewing gum was true. Glad to hear it isn&#8217;t.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/11/whats-the-right-iteration-length/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiler configuration</title>
		<link>http://www.klocwork.com/blog/2011/10/compiler-configuration/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=compiler-configuration</link>
		<comments>http://www.klocwork.com/blog/2011/10/compiler-configuration/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 13:32:55 +0000</pubDate>
		<dc:creator>Alen Zukich</dc:creator>
				<category><![CDATA[Static Analysis]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[gcc]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1403</guid>
		<description><![CDATA[Compiler configuration is a problem with static analysis tools.  In the past, a static analysis (or source code analysis) tool simply worked by pointing it at the source code and hitting &#8220;go&#8221;.  Now it is very different.  Without a complete understanding of the software build, including the compiler specifics, you will get inaccurate results. Under [...]]]></description>
			<content:encoded><![CDATA[<p>Compiler configuration is a problem with static analysis tools.  In the past, a static analysis (or source code analysis) tool simply worked by pointing it at the source code and hitting &#8220;go&#8221;.  Now it is very different.  Without a complete understanding of the software build, including the compiler specifics, you will get inaccurate results.</p>
<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/10/a12012.gif"><img class="alignleft size-full wp-image-1406" title="Compiler toolchain" src="http://www.klocwork.com/blog/wp-content/uploads/2011/10/a12012.gif" alt="" width="280" height="391" /></a>Under the covers, do you really know what is happening with your compiler?  Not usually.  You make changes to your code, call your compiler or build command to compile your code, and then fix the issues.  Rinse and repeat.</p>
<p>But what is really important for static analysis tools, is that the compiler contains some crucial information to successfully compile your code.  Namely, the internal compiler includes and defines.  Static analysis tools must generate this data, otherwise they won&#8217;t know where the system includes and defines are coming from for your specific compiler.  Hence, the static analysis results are about as accurate as the weather man&#8217;s weekly prediction.</p>
<p>Luckily most compilers have a way to capture this.  For example to find out the defines and includes from gcc:</p>
<pre><code>gcc -E -dM dummy.c

gcc -E -Wp,-v dummy.c
</code></pre>
<p>Where dummy.c is just an empty file.  This will give you a dump of all the defines and includes, respectively.  Now, when static analysis tools build their data they have a mapping of the proper defines and includes for your specific compiler and everyone is happy.</p>
<p>In the past, it seemed like a good idea to make compiler configuration extensible.  This meant that static analysis tools could support any compiler if you didn&#8217;t mind taking the time to build that support.  It wasn&#8217;t usually very complex but it could be prone to errors.  Instead, it makes more sense to just provide the support right out of the box, so taking the words from the late Steve Jobs: &#8220;<em>it just works</em>&#8220;.  As long as static analysis tools have an extensible interface, these tools should be able to support new and obscure compilers very quickly.  Make sure your static analysis vendor has support for your specific compiler that you use, and if they don&#8217;t they better turn that around in a snap.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/10/compiler-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is Pure Agile Always an Option?</title>
		<link>http://www.klocwork.com/blog/2011/10/is-pure-agile-always-an-option/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=is-pure-agile-always-an-option</link>
		<comments>http://www.klocwork.com/blog/2011/10/is-pure-agile-always-an-option/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 13:50:27 +0000</pubDate>
		<dc:creator>Todd Landry</dc:creator>
				<category><![CDATA[Agile Development]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[General Coding]]></category>
		<category><![CDATA[General Industry]]></category>
		<category><![CDATA[Medical Device Software]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[medical device software]]></category>
		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1397</guid>
		<description><![CDATA[Over the past few years I’ve talked to a number of customers in the embedded software and medical devices industries, and I continue to see a significant number of these organizations either moving to, or planning on moving to agile development processes. With all of the inherent challenges for agile in these organizations such as [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past few years I’ve talked to a number of customers in the embedded software and medical devices industries, and I continue to see a significant number of these organizations either moving to, or planning on moving to agile development processes.</p>
<p>With all of the inherent challenges for agile in these organizations such as standards/regulatory compliance, hardware changes and integration, security issues, etc. I must say that I’m a little shocked that customers are moving away from their current processes towards something like agile. Add to this the fact that the Agile Manifesto specifically states “Working software over comprehensive documentation” and it doesn’t exactly sound like agile is a great fit for embedded systems in general, let alone medical device.</p>
<p>Now, don’t get me wrong, I am a huge proponent of agile, and I certainly realize that there are many pros for moving to agile, and these have been well <a href="http://www.objectmentor.com/omSolutions/agile_why.html">documented</a>, but I have to wonder just how agile are these specific industries going?  I would bet that most (all?) of these organizations are adopting some of the key fundamentals of agile, but to say they are going “all in” would be a bit of a stretch.</p>
<p><br class="spacer_" /></p>
<div id="attachment_1400" class="wp-caption alignright" style="width: 310px"><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/10/whales-10.jpg"><img class="size-medium wp-image-1400" title="whales-10" src="http://www.klocwork.com/blog/wp-content/uploads/2011/10/whales-10-300x193.jpg" alt="" width="300" height="193" /></a><p class="wp-caption-text">Even industries heavy on process (because of regulatory requirements) are taking the leap into agile. How agile are they?</p></div>
<p>Looking at the <a href="http://agilemanifesto.org/">manifesto</a> a little closer, some of the principles are fairly generic and feel more like common sense than anything revolutionary, so they probably apply to any industry. There are a few principles however that are fairly easy to imagine in these industries, such as:</p>
<ul>
<li> getting all stakeholders involved in defining requirements (Principle #4), or </li>
<li>embracing more face-to-face conversations (Principle #6), and </li>
<li>simplicity, or minimizing the amount of work not done (Principle #10). </li>
</ul>
<p>But do people really think that Principles #1 (early and often delivery of software), and #2 (welcome changing requirements) really apply to the embedded or medical devices industries? Personally I don’t see it.</p>
<p>So what do you think? Are the embedded software or medical devices industries capable of going full out Agile?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/10/is-pure-agile-always-an-option/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Microsoft banned function list</title>
		<link>http://www.klocwork.com/blog/2011/09/microsoft-banned-function-list/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=microsoft-banned-function-list</link>
		<comments>http://www.klocwork.com/blog/2011/09/microsoft-banned-function-list/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 19:58:37 +0000</pubDate>
		<dc:creator>Alen Zukich</dc:creator>
				<category><![CDATA[Software Security]]></category>
		<category><![CDATA[banned functions]]></category>
		<category><![CDATA[buffer overflow]]></category>
		<category><![CDATA[SDL]]></category>
		<category><![CDATA[source code analysis]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1389</guid>
		<description><![CDATA[We have blogged before about software security guidelines, but there is one we haven&#8217;t discussed.  Several years ago Microsoft published the &#8220;Security Development Lifecycle (SDL) Banned Function Calls&#8221; list.  These banned functions can be a good way to remove a significant number of potential code vulnerabilities from C and C++ code.  They provide recommendations on [...]]]></description>
			<content:encoded><![CDATA[<p>We have blogged before about <a href="http://www.klocwork.com/blog/2010/06/the-alphabet-soup-of-software-security-guidelines/">software security guidelines</a>, but there is one we haven&#8217;t discussed.  Several years ago Microsoft published the &#8220;<a href="http://msdn.microsoft.com/en-us/library/bb288454.aspx" target="_blank">Security Development Lifecycle (SDL) Banned Function Calls</a>&#8221; list.  These banned functions can be a good way to remove a significant number of potential code vulnerabilities from C and C++ code.  They provide recommendations on better or safer functions to use with the caveat that even these &#8220;safer&#8221; function should be used with care.</p>
<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/09/banned.jpg"><img class="alignleft size-full wp-image-1391" title="banned" src="http://www.klocwork.com/blog/wp-content/uploads/2011/09/banned.jpg" alt="" width="204" height="204" /></a>You can use the <a href="http://www.microsoft.com/download/en/details.aspx?id=24817">banned.h</a> file to identify and obtain deprecation warnings or, even better, use this as part of your source code analysis.  Leveraging these warning as part of your source code analysis solution means you have better ways to filter and manage the solution as opposed to a dump of potentially thousands of warnings.  Add that into your code review tool and you have some good discussion points for your peer code reviews.</p>
<p>Like any security guideline, the question becomes how useful are these?  There is no question that these banned functions are <a href="http://sigttou.com/ban-programmers-not-functions" target="_blank">debatable</a>.  The complaint that I hear the most is that &#8220;n&#8221; functions can be used safely so they should not be part of the list.  But you can still get yourself in a whole heap of trouble with these functions as well.  Take this example from Micheal Howard&#8217;s blog:  <a href="http://blogs.msdn.com/b/michael_howard/archive/2004/10/29/249713.aspx" target="_blank">Buffer Overflow in Apache 1.3.xx fixed on Bugtraq &#8211; the evils of strncpy and strncat!</a>.</p>
<p>I believe there is merit in identifying these functions so you can ask yourself if you&#8217;re using them securely.  For more information and training on the Microsoft SDL you can look at the course &#8220;<a href="http://developer.klocwork.com/klocwork-university/security-innovation/microsoft-sdl" target="_blank">Intro to the Microsoft Security Development Lifecycle</a>&#8221; on our web page.</p>
<p>Is anyone out there using the Microsoft banned function list religiously?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/09/microsoft-banned-function-list/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Secure Coding eLearning Resource</title>
		<link>http://www.klocwork.com/blog/2011/09/secure-coding-elearning-resource/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=secure-coding-elearning-resource</link>
		<comments>http://www.klocwork.com/blog/2011/09/secure-coding-elearning-resource/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 14:49:13 +0000</pubDate>
		<dc:creator>Brendan Harrison</dc:creator>
				<category><![CDATA[General Coding]]></category>
		<category><![CDATA[Software Security]]></category>
		<category><![CDATA[elearning]]></category>
		<category><![CDATA[Microsoft Security Development Lifecycle]]></category>
		<category><![CDATA[OWASP]]></category>
		<category><![CDATA[software security]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1382</guid>
		<description><![CDATA[One of the common challenges we hear from customers regarding their software security assurance programs is developer education. Sure, there are many great tools out there that can help with security, but when it comes down to it, if you&#8217;re going to truly build a culture of secure software (and not just audit your system [...]]]></description>
			<content:encoded><![CDATA[<p>One of the common challenges we hear from customers regarding their <a title="Software Security Assurance" href="http://www.klocwork.com/solutions/software-security-assurance/" target="_blank">software security assurance</a> programs is developer education. Sure, there are many great tools out there that can help with security, but when it comes down to it, if you&#8217;re going to truly build a culture of secure software (and not just audit your system now and then), your development team needs to be well versed on key security concepts, defensive coding principles, common attack vectors, not to mention the ins and outs of specific coding vulnerabilities like <a title="Buffer Overflow" href="http://www.klocwork.com/products/documentation/current/Checkers:ABR" target="_blank">buffer overflows</a>.</p>
<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/09/secure-coding-ccxx1.png"><img class="alignright size-full wp-image-1384" title="secure-coding-ccxx" src="http://www.klocwork.com/blog/wp-content/uploads/2011/09/secure-coding-ccxx1.png" alt="Secure Coding for C/C++ Course" width="697" height="560" /></a></p>
<p>Well, we agree. That&#8217;s why we&#8217;ve partnered with our friends at <a title="Security Innovation" href="http://www.securityinnovation.com/" target="_blank">Security Innovation</a> to make some of their developer eLearning courses available for free on the new, revamped <a title="Klocwork University" href="http://developer.klocwork.com/klocwork-university" target="_blank">Klocwork University</a>. I encourage you to check out the <a title="Secure Coding for C/C++" href="http://developer.klocwork.com/klocwork-university/security-innovation/secure-coding" target="_blank">Secure Coding for C/C++</a> course &#8211; it&#8217;s approx 60 minutes in length, features interactive material, and is a great introductory course into many of the key concepts required to build secure software. We also have a course on Microsoft&#8217;s Secure SDL and the OWASP Top 10. Check it out!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/09/secure-coding-elearning-resource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Klocwork University consolidates learning resources into a single roster</title>
		<link>http://www.klocwork.com/blog/2011/09/klocwork-university-consolidates-learning-resources-into-a-single-roster/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=klocwork-university-consolidates-learning-resources-into-a-single-roster</link>
		<comments>http://www.klocwork.com/blog/2011/09/klocwork-university-consolidates-learning-resources-into-a-single-roster/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 16:42:48 +0000</pubDate>
		<dc:creator>Patti Murphy</dc:creator>
				<category><![CDATA[General Coding]]></category>
		<category><![CDATA[Static Analysis]]></category>
		<category><![CDATA[e-learning]]></category>
		<category><![CDATA[Klocwork Developer Network]]></category>
		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1368</guid>
		<description><![CDATA[Klocwork Developer Network presents Klocwork University, which consolidates all our online learning resources onto a single page. Klocwork University is your one stop for self-paced online learning and how-tos about: Setting up and using our static analysis tools on your desktop or integration build The latest trends in software security Agile coding practices and how [...]]]></description>
			<content:encoded><![CDATA[<p>Klocwork Developer Network presents <a href="http://developer.klocwork.com/klocwork-university/" target="_blank">Klocwork University</a>, which consolidates all our online learning resources onto a single page.</p>
<p><a href="http://developer.klocwork.com/klocwork-university/"><img class="alignright size-full wp-image-1379" title="KlocU3" src="http://www.klocwork.com/blog/wp-content/uploads/2011/09/KlocU31.png" alt="" width="381" height="207" /></a></p>
<p>Klocwork University is your one stop for self-paced online learning and how-tos about:</p>
<ul>
<li>Setting up and using our static analysis tools on your desktop or integration build </li>
<li>The latest trends in software security</li>
<li>Agile coding practices and how they intersect with static analysis</li>
<li>Klocwork product overviews</li>
</ul>
<p>At Klocwork University you&#8217;ll see helpful descriptions of:</p>
<ul>
<li> In-house and partner-generated e-learning courses</li>
<li>Video how-tos</li>
<li>Webinars</li>
</ul>
<p>After you  browse our offerings on the Klocwork University page, click your  selection and access your resource. If you&#8217;re not already logged in to  the Klocwork Developer Network, you&#8217;ll be prompted to log in or register  to use these free resources.</p>
<p>This change  pulls the course content descriptions from behind the login wall to  provide a searchable list for members and non-members alike.</p>
<p>At Klocwork  University, you get the information up front and you can schedule your  pub breaks when and where you want. Join today. There&#8217;s no free beer  though.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/09/klocwork-university-consolidates-learning-resources-into-a-single-roster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Squeezing max from the  ‘try/finally’ blocks</title>
		<link>http://www.klocwork.com/blog/2011/08/squeezing-max-from-the-tryfinally-blocks/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=squeezing-max-from-the-tryfinally-blocks</link>
		<comments>http://www.klocwork.com/blog/2011/08/squeezing-max-from-the-tryfinally-blocks/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 15:22:31 +0000</pubDate>
		<dc:creator>Mikhail Ksenzov</dc:creator>
				<category><![CDATA[General Coding]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1362</guid>
		<description><![CDATA[I often hear that closing resources properly is way too verbose in Java, especially considering that resource freeing methods such as ‘close()&#8217; are often throwing some type of an exception. However, if you handle resources properly it might turn out to be less of a burden than one might think. Let&#8217;s start with the following [...]]]></description>
			<content:encoded><![CDATA[<p>I often hear that closing resources properly is way too verbose in Java, especially considering that resource freeing methods such as ‘close()&#8217; are often throwing some type of an <a href="http://download.oracle.com/javase/1.5.0/docs/api/java/io/Closeable.html#close%28%29">exception</a>. However, if you handle resources properly it might turn out to be less of a burden than one might think. Let&#8217;s start with the following snippet, where I use an SQL driver to retrieve the list of “codes” matching the given “id”:</p>
<pre><span style="font-size: small;">09 List&lt;String&gt; requestCodes(String dbUrl, String id) {
10   List&lt;String&gt; result = <strong>new</strong> ArrayList&lt;String&gt;();
11   <strong>try</strong> {
12     Connection conn = DriverManager.getConnection(dbUrl);
13     PreparedStatement stmt = conn.prepareStatement("SELECT * FROM customers WHERE id = ?");
14     stmt.setString(1, id);
15     ResultSet rs = stmt.executeQuery();
16     <strong>while</strong> (rs.next()) {
17       result.add(rs.getString("code"));
18     }
19   } <strong>catch</strong> (SQLException e) {
20      e.printStackTrace();
21   }
22   <strong>return</strong> result;
23 }</span></pre>
<p>The problem with the code above is that it allocates SQL server resources but fails to properly release them. More specifically:</p>
<ul>
<li>Line 12: SQL connection &#8216;conn&#8217; is not closed on exit. </li>
<li>Line 13: SQL object &#8216;stmt&#8217; is not closed on exit. </li>
<li>Line 16: SQL object &#8216;rs&#8217; is not closed on exit. </li>
</ul>
<p>The next snippet illustrates how one can fix the defects listed above:</p>
<pre><span style="font-size: small;">09 List&lt;String&gt; requestCodes(String dbUrl, String id) {
10   List&lt;String&gt; result = new ArrayList&lt;String&gt;();
11   Connection conn = <strong>null</strong>;
12   PreparedStatement stmt = <strong>null</strong>;
13   ResultSet rs = <strong>null</strong>;
14   <strong>try</strong> {
15     conn = DriverManager.getConnection(dbUrl);
16     stmt = conn.prepareStatement("SELECT * FROM customers WHERE id = ?");
17     stmt.setString(1, id);
18     rs = stmt.executeQuery();
19     <strong>while</strong> (rs.next()) {
20       result.add(rs.getString("code"));
21     }
22   } <strong>catch</strong> (SQLException e) {
23     e.printStackTrace();
24   } <strong>finally</strong> {
25     <strong>if</strong> (rs != <strong>null</strong>) {
26       <strong>try</strong> {
27         rs.close();          // close() throws an exception...
28       } <strong>catch</strong> (SQLException e) {
29         e.printStackTrace(); // ...have to catch it to free 'stmt'
30       }
31     }
32     <strong>if</strong> (stmt != <strong>null</strong>) {
33       <strong>try</strong> {
34         stmt.close();        // again, close() throws an exception...
35       } <strong>catch</strong> (SQLException ignore) {
36         e.printStackTrace(); // ...have to catch it to free 'conn'
37       }
38     }
39     <strong>if</strong> (conn != <strong>null</strong>) {
30       <strong>try</strong> {
41         conn.close();
42       } <strong>catch</strong> (SQLException ignore) {
43         e.printStackTrace();
44       }
45     }
46   }
47   <strong>return</strong> result;
48 }</span></pre>
<p><span style="font-size: small;">T</span>he code above is correct but extremely verbose. However, it can be improved without sacrifices in semantics&#8230;</p>
<p><strong>Tip #1</strong>: It is better to allocate a resource before the &#8216;try/finally&#8217; block, not inside it. Let&#8217;s start with the following code:</p>
<pre><span style="font-size: small;">Connection conn = <strong>null</strong>;<strong>
try</strong> {
  conn = DriverManager.getConnection(dbUrl);
  // use conn
} <strong>finally</strong> {<strong>
  if</strong> (conn != <strong>null</strong>) {
    conn.close();
  }
}</span>
</pre>
<p>can be rewritten as:</p>
<pre><span style="font-size: small;">Connection conn = DriverManager.getConnection(dbUrl);<strong>
try</strong> {
  // use conn
} <strong>finally</strong> {
  conn.close();
}</span></pre>
<p><strong>Tip #2</strong>: Use nested &#8216;try/finally&#8217; blocks if you allocate a sequence of resources. Let’s start with a snippet:</p>
<pre><span style="font-size: small;"><strong>try</strong> {
  Connection conn = DriverManager.getConnection(dbUrl);
  PreparedStatement stmt = conn.prepareStatement("SELECT * FROM customers WHERE id = ?");<strong>
  try</strong> {
    // use conn
    // use stmt
  } <strong>finally</strong> {<strong>
    try</strong> {
      conn.close();
    } <strong>catch</strong> (SQLException e) {
      e.printStackTrace();
    }
<strong>    try</strong> {
       stmt.close();
    } <strong>catch</strong> (SQLException e) {
      e.printStackTrace();
    }
  }
} <strong>catch</strong> (SQLException e) {
  e.printStackTrace();
}</span></pre>
<p>How many problems have you noticed in the snippet above? I found three:</p>
<ul>
<li>Allocation of resource &#8216;stmt&#8217; can throw an exception before we enter the outer &#8216;try/catch/finally&#8217;. If happens &#8216;conn&#8217; will never be freed.</li>
<li>We duplicate code for the SQLException handling. We were lucky to have only one line of code replicated, but it in general cases exception handling can be a bit more involved that we see here&#8230;</li>
<li>The order of resource allocation does not match the order of deallocation: here the order of deallocation should be reversed to be correct.</li>
</ul>
<p>The only robust way to handle resource allocation/deallocation and to address the issues listed above is to use nested try/finally blocks:</p>
<pre><span style="font-size: small;"><strong>try</strong> {
  Connection conn = DriverManager.getConnection(dbUrl);
<strong>  try</strong> {
    // use conn
    PreparedStatement stmt = conn.prepareStatement("SELECT * FROM customers WHERE id = ?");<strong>
    try</strong> {<strong>
</strong>      // use stmt
    } <strong>finally</strong> {
      stmt.close();
    }
  } <strong>finally</strong> {
    conn.close();
  }
} <strong>catch</strong> (SQLException e) {
  e.printStackTrace();
}</span>
</pre>
<p>Let’s apply tips #1 and #2 to our original method and fix the resource leaks on lines 12, 13, 16:</p>
<pre><span style="font-size: small;">09 List&lt;String&gt; requestCodes(String dbUrl, String id) {
10   List&lt;String&gt; result = new ArrayList&lt;String&gt;();
11   <strong>try</strong> {
12     Connection conn = DriverManager.getConnection(dbUrl);
13     <strong>try</strong> {
14       PreparedStatement stmt = conn.prepareStatement("SELECT * FROM customers WHERE id = ?");
15       <strong>try</strong> {
16         stmt.setString(1, id);
17         ResultSet rs = stmt.executeQuery();
18         <strong>try</strong> {
19           <strong>while</strong> (rs.next()) {
20             result.add(rs.getString("code"));
21           }
22         } <strong>finally</strong> {
23           rs.close();
24         }
25       } <strong>finally</strong> {
26          stmt.close();
27       }
28     } <strong>finally</strong> {
29       conn.close();
30     }
31   } <strong>catch</strong> (SQLException e) {
32     e.printStackTrace();
33   }
34   <strong>return</strong> result;
35 }</span>
</pre>
<p>This is way shorter than the original solution!</p>
<p><strong>Tip #3</strong>: If after applying tip #2 you feel that all your code drifted way too close to the right page margin it means that you probably have too much nested &#8216;try/finally&#8217; blocks and that is time to check if you actually want to have all the resources allocated at the same time. Chances are that you do not need them all; otherwise use the <a href="http://c2.com/cgi/wiki?ExtractMethod">Extract Method</a> refactoring pattern to move out some of the resource access logic.</p>
<p><strong>Tip #4</strong>: Know specific behavior of resources you are dealing with. While tips #1 &#8211; #3 provide a robust and compact approach for dealing with resource allocation/deallocation <em>in general</em>, in certain cases you can make code even more compact. In our example: <a href="http://download.oracle.com/javase/6/docs/api/java/sql/Statement.html#close%28%29">Statement.close()</a> closes its current ResultSet object if one exists. Likewise <a href="http://download.oracle.com/javase/6/docs/api/java/sql/Connection.html#close%28%29">Connections.close()</a> releases JDBC resources. It means that if you deal specifically with JDBC it would be sufficient to close the ‘parent’ resource to be sure that all ‘subresources’ will be properly released:</p>
<pre><span style="font-size: small;">09 List&lt;String&gt; requestCodes(String dbUrl, String id) {
10   List&lt;String&gt; result = new ArrayList&lt;String&gt;();
11   <strong>try</strong> {
12     Connection conn = DriverManager.getConnection(dbUrl);
13     <strong>try</strong> {
14       PreparedStatement stmt = conn.prepareStatement("SELECT * FROM customers WHERE id = ?");
15       stmt.setString(1, id);
16       ResultSet rs = stmt.executeQuery();
17       <strong>while</strong> (rs.next()) {
18         result.add(rs.getString("code"));
19       }
20     } <strong>finally</strong> {
21       conn.close();
22     }
23   } <strong>catch</strong> (SQLException e) {
24     e.printStackTrace();
25   }
26   <strong>return</strong> result;
27 }</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/08/squeezing-max-from-the-tryfinally-blocks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Importance of MISRA</title>
		<link>http://www.klocwork.com/blog/2011/07/importance-of-misra/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=importance-of-misra</link>
		<comments>http://www.klocwork.com/blog/2011/07/importance-of-misra/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 12:58:42 +0000</pubDate>
		<dc:creator>Alen Zukich</dc:creator>
				<category><![CDATA[Coding Standards]]></category>
		<category><![CDATA[c99]]></category>
		<category><![CDATA[MISRA]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1338</guid>
		<description><![CDATA[Recently I was at our European partner advisory board.  This is a session where we all get together and talk about the current market, the upcoming release and anything else to help our partners be more successful.  The most valuable sessions for myself is hearing from the partners on what works and what doesn&#8217;t.  This [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/06/misralogo1.gif"><img class="alignleft size-full wp-image-1341" title="misralogo" src="http://www.klocwork.com/blog/wp-content/uploads/2011/06/misralogo1.gif" alt="" width="204" height="166" /></a>Recently I was at our European partner advisory board.  This is a session where we all get together and talk about the current market, the upcoming release and anything else to help our partners be more successful.  The most valuable sessions for myself is hearing from the partners on what works and what doesn&#8217;t.  This ranges from commercial issues to technical issues with the product.</p>
<p><br class="spacer_" /></p>
<p>One very clear message from all the partners was that our MISRA support was a huge plus.  Here in North America we have seen small pockets of adoption, but in Europe and even Asia it used quite a bit.  As we have mentioned in the <a href="http://www.klocwork.com/blog/2010/03/misra-more-irrelevant-software-requirements-again/" target="_blank">past</a>, it is not only automotive organization but all levels of business.</p>
<p><br class="spacer_" /></p>
<p>Soon MISRA C 2011 will be released.  Look forward to seeing all the changes especially with the added support of <a href="http://en.wikipedia.org/wiki/C99" target="_blank">C99</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/07/importance-of-misra/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Electronic imports contain security threats</title>
		<link>http://www.klocwork.com/blog/2011/07/electronic-imports-contain-security-threats/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=electronic-imports-contain-security-threats</link>
		<comments>http://www.klocwork.com/blog/2011/07/electronic-imports-contain-security-threats/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 17:29:26 +0000</pubDate>
		<dc:creator>Alen Zukich</dc:creator>
				<category><![CDATA[Software Security]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[software security]]></category>
		<category><![CDATA[Static Analysis]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1354</guid>
		<description><![CDATA[I read an interesting post on electronic imports that could contain security threats.  I can only speak from the software perspective, but I can say that most customers I’ve dealt with usually integrate some sort of software security audit process with any 3rd-party integrator and from my experience that means adopting static analysis.  How many [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/07/computer-security.jpg"><img class="alignleft size-full wp-image-1356" title="computer-security" src="http://www.klocwork.com/blog/wp-content/uploads/2011/07/computer-security.jpg" alt="" width="196" height="258" /></a>I read an interesting <a href="http://www.reuters.com/article/2011/07/11/cybersecurity-electronics-idUSN1E76A0SF20110711" target="_blank">post</a> on electronic imports that could contain security threats.  I can only speak from the software perspective, but I can say that most customers I’ve dealt with usually integrate some sort of software security audit process with any 3<sup>rd</sup>-party integrator and from my experience that means adopting static analysis.  How many organizations are there that haven’t jumped on board with static analysis?  Probably more than I can count.</p>
<p>It would be very interesting to hear of some of the Armed Services and Intelligence cyber threats that the government has not publically disclosed.  That might be an eye opener.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/07/electronic-imports-contain-security-threats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>He crossed the line–testing to development</title>
		<link>http://www.klocwork.com/blog/2011/07/he-crossed-the-line-testing-to-development/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=he-crossed-the-line-testing-to-development</link>
		<comments>http://www.klocwork.com/blog/2011/07/he-crossed-the-line-testing-to-development/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 13:21:01 +0000</pubDate>
		<dc:creator>Patti Murphy</dc:creator>
				<category><![CDATA[General Coding]]></category>
		<category><![CDATA[Software Career]]></category>
		<category><![CDATA[Software Testing]]></category>
		<category><![CDATA[testers and developers can get along]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[vampires]]></category>
		<category><![CDATA[werewolves]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1349</guid>
		<description><![CDATA[Instead of fomenting dissent (that barely exists) in a brazen attempt to boost readership, I&#8217;m changing tactics to look at ways in which testing and development are complementary, beyond their common goal of releasing quality software products. What can I say? After my previous post, How developers drive testers nuts–let’s count the ways, I&#8217;m clearly getting [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1353" class="wp-caption alignright" style="width: 489px"><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/07/Michail_vampire.png"><img class="size-full wp-image-1353 " title="Michail_vampire" src="http://www.klocwork.com/blog/wp-content/uploads/2011/07/Michail_vampire.png" alt="" width="479" height="358" /></a><p class="wp-caption-text">Michail the friendly, programming vampire.</p></div>
<p>Instead of fomenting dissent (that barely exists) in a brazen attempt to boost readership, I&#8217;m changing tactics to look at ways in which testing and development are complementary, beyond their common goal of releasing quality software products.</p>
<p>What can I say? After my previous post, <a href="http://www.klocwork.com/blog/2011/02/how-developers-drive-testers-nuts-lets-count-the-ways/" target="_blank">How developers drive testers nuts–let’s count the ways</a>, I&#8217;m clearly getting less edgy.</p>
<p>I approached our newest addition to the Klocwork development team, Michail Greshishchev. While he&#8217;s a new full-timer, Greshishchev is not a new face around here.</p>
<p>The recent Carleton University engineering graduate did two co-op terms here&#8211;one in professional services and the other in testing.</p>
<p>So I asked Greshishchev how his stint in testing affected his development. Here&#8217;s exactly what he said:</p>
<ol>
<li>Writing short, efficient unit tests comes naturally after dealing with mammoth testing frameworks. Most of the code I write are tests – the techniques and skills I&#8217;ve learned in testing are fully applicable to development.</li>
<li>Developers have no idea how to execute a test in our automated test system (I don&#8217;t blame them&#8211;the test machine is a large, well-oiled beast distributed over dozens of operating environments). Having the knowledge to run test team tests on developer builds means I don&#8217;t need to wait for nightly build test results to address issues. More importantly, I can add my own tests to the test team&#8217;s automated test system.</li>
<li>It&#8217;s common for a developer to request more information about a tester&#8217;s problem report. My experience with the test team allows me to access the information on test machines myself, saving time for everyone.</li>
<li>The test report pages actually make sense. This allows me to investigate test failures in the nightly build before a tester comes to my desk to tell me I broke something.</li>
</ol>
<p>His experience as part of the test team has been win-win for him and his colleagues. Testing and development sound like allies, don&#8217;t they? Well, as much as <a href="http://www.klocwork.com/blog/2011/02/how-developers-drive-testers-nuts-lets-count-the-ways/" target="_blank">werewolves</a> and vampires can be allies, I suppose. And he was such a nice guy too, but the change is upon him.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/07/he-crossed-the-line-testing-to-development/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New programs for software security</title>
		<link>http://www.klocwork.com/blog/2011/07/new-programs-for-software-security/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=new-programs-for-software-security</link>
		<comments>http://www.klocwork.com/blog/2011/07/new-programs-for-software-security/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 17:48:52 +0000</pubDate>
		<dc:creator>Alen Zukich</dc:creator>
				<category><![CDATA[General Coding]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1350</guid>
		<description><![CDATA[The U.S. Department of Homeland Security, in conjunction with the SANS Institute and Mitre have been hard at work again.  See the article.  There are two new programs called the Common Weakness Risk Analysis Framework (CWRAF) and the Common Weakness Scoring System (CWSS).  Using these two in conjunction will help users identify the most important [...]]]></description>
			<content:encoded><![CDATA[<p>The U.S. Department of Homeland Security, in conjunction with the SANS  Institute and Mitre have been hard at work again.  See the <a href="http://www.scmagazineus.com/dhs-unveils-new-programs-for-software-security/article/206253/" target="_blank">article</a>.  There are two new programs called the <a href="http://cwe.mitre.org/cwraf/index.html#overview" target="_blank">Common Weakness Risk Analysis Framework</a> (CWRAF) and the <a href="http://cwe.mitre.org/cwss/index.html">Common Weakness Scoring System</a> (CWSS).  Using these two in conjunction will help users identify the most   important weaknesses for their business.  It will be interesting to see adoption in the upcoming weeks.</p>
<p>In addition to CWRAF and CWSS the <a href="http://cwe.mitre.org/top25/" target="_blank">2011 CWE/SANS Top 25</a> list has been updated.  There has been a number of position changes and a few that have been knocked out and replaced by <a href="http://cwe.mitre.org/data/definitions/250.html" target="_blank">CWE-250</a>, <a href="http://cwe.mitre.org/data/definitions/676.html" target="_blank">CWE-676</a>, <a href="http://cwe.mitre.org/data/definitions/134.html" target="_blank">CWE-134</a>, and <a href="http://cwe.mitre.org/data/definitions/759.html" target="_blank">CWE-759</a>.  Not too many surprises but I never really noticed CWE-134 not in the list before.  That certainly makes sense.  However it does shock me that <a href="http://cwe.mitre.org/data/definitions/129.html" target="_blank">CWE-129</a> (Improper Validation of Array Index) didn&#8217;t make the list this year.  Certainly a problem that I&#8217;ve seen a ton, although it was close (#27).  To see Klocwork&#8217;s coverage of 2011 CWE/SANS Top 25 go <a href="http://www.klocwork.com/products/documentation/current/2011_CWE-SANS_Top_25_Most_Dangerous_Software_Errors_mapped_to_Klocwork_checkers" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/07/new-programs-for-software-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Evolution of Static Code Analysis – Part 3: The Present Day</title>
		<link>http://www.klocwork.com/blog/2011/06/the-evolution-of-static-code-analysis-part-3-the-present-day/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=the-evolution-of-static-code-analysis-part-3-the-present-day</link>
		<comments>http://www.klocwork.com/blog/2011/06/the-evolution-of-static-code-analysis-part-3-the-present-day/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 20:10:37 +0000</pubDate>
		<dc:creator>Todd Landry</dc:creator>
				<category><![CDATA[General Coding]]></category>
		<category><![CDATA[General Industry]]></category>
		<category><![CDATA[Software Quality]]></category>
		<category><![CDATA[Software Security]]></category>
		<category><![CDATA[code analysis]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[source code analysis]]></category>
		<category><![CDATA[Static Analysis]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1322</guid>
		<description><![CDATA[My first 2 posts looked at 2 different eras of Static Code Analysis, the Early Years and the Early 21st Century. The SCA solutions of these times were revolutionary, and helped software development teams a great deal. But they had their warts. In the final post in this series, I’m going to introduce you to [...]]]></description>
			<content:encoded><![CDATA[<p>My first 2 posts looked at 2 different eras of Static Code Analysis, the <a href="http://www.klocwork.com/blog/2011/05/the-evolution-of-static-code-analysis-part-1-the-early-years/">Early Years</a> and the <a href="http://www.klocwork.com/blog/2011/05/the-evolution-of-source-code-analysis-part-2-the-early-21st-century/">Early 21</a><sup><a href="http://www.klocwork.com/blog/2011/05/the-evolution-of-source-code-analysis-part-2-the-early-21st-century/">st</a></sup><a href="http://www.klocwork.com/blog/2011/05/the-evolution-of-source-code-analysis-part-2-the-early-21st-century/"> Century</a>. The SCA solutions of these times were revolutionary, and helped software development teams a great deal. But they had their warts.</p>
<p>In the final post in this series, I’m going to introduce you to the present day Static Code Analysis technology and how it is impacting developers.</p>
<p><strong>The Present Day</strong></p>
<p>I’m a huge fan of Reece’s Peanut Butter Cups. I love them. I keep active so I don&#8217;t feel guilty eating them. In a strange, convoluted way, the 3<sup>rd</sup> generation of static code analysis tools are like this delicious combination of chocolate and peanut butter. Let me explain.</p>
<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/05/reeces.jpeg"><img class="size-full wp-image-1323 alignright" title="reeces" src="http://www.klocwork.com/blog/wp-content/uploads/2011/05/reeces.jpeg" alt="" width="259" height="194" /></a></p>
<div class="mceTemp">I’m sure you remember from my previous posts how the 1<sup>st</sup> generation tools (i.e. Lint) gave questionable results but was still considered by developers as a tool exclusively for them, and the 2<sup>nd</sup> generation tools gave really good results but moved away from being a developer tool.</div>
<div class="mceTemp">The 3<sup>rd</sup> generation tools recognized that the developer must be an integral part of the process of identifying, fixing and preventing bugs from reaching the code stream and so, they took the proven results from the 2<sup>nd</sup> gen tools and delivered them right to the developer’s desktop.</div>
<p>Eureka! Now developers are able to perform an analysis locally, using their development environment of choice, while still getting the high accuracy and consistency that was previously only possible by checking in their code and waiting for the integration build to take place.</p>
<p>Think about the ramifications of this:</p>
<ul>
<li>cleaner code is being checked in </li>
<li>the ‘rinse-repeat’ vicious cycle of rework is drastically reduced</li>
<li>quality teams are now able to focus on testing the product’s functionality rather than spending cycles uncovering something that could easily and quickly be found by automated tools. </li>
</ul>
<p>Mmmm-mmmm good. Sounds like a win-win-win to me!</p>
<p>I think the best thing about these 3rd generation tools is simply the fact that developers are now able to resume ownership of the quality and security of the code they are producing.</p>
<p>Well, I hope you enjoyed this walk down memory lane. I sure did. Now I&#8217;m looking for spare change because I see a trip to the vending machine in my immediate future.</p>
<p>If you want to know more about the 3rd Generation tools, feel free to drop me a line.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/06/the-evolution-of-static-code-analysis-part-3-the-present-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To report, or not to report…</title>
		<link>http://www.klocwork.com/blog/2011/06/to-report-or-not-to-report/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=to-report-or-not-to-report</link>
		<comments>http://www.klocwork.com/blog/2011/06/to-report-or-not-to-report/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 20:10:20 +0000</pubDate>
		<dc:creator>Gwyn Fisher</dc:creator>
				<category><![CDATA[Nasty Bugs]]></category>
		<category><![CDATA[Software Quality]]></category>
		<category><![CDATA[Software Security]]></category>
		<category><![CDATA[Static Analysis]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1333</guid>
		<description><![CDATA[Creating a source code analysis (SCA) engine is a balancing act, a decision process of where you believe the most value can be found along the spectrum that is the signal-to-noise ratio of the detection process. At one end lies the realm of massive noise and hopefully complete coverage, whilst at the other is the [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="margin-left: 5px; margin-right: 5px;" src="http://images.all-free-download.com/images/graphiclarge/balance_scale_clip_art_10655.jpg" alt="Balance" width="425" height="274" />Creating a source code analysis (SCA) engine is a balancing act, a decision process of where you believe the most value can be found along the spectrum that is the signal-to-noise ratio of the detection process. At one end lies the realm of massive noise and hopefully complete coverage, whilst at the other is the quiet calm of the theoretically useful but ultimately useless realm of no noise, but ultimately no signal either.</p>
<p>That may sound counter-intuitive. Shouldn’t a zero noise point on the spectrum be accompanied by an infinitely strong signal? Perhaps in the world of DSP this is true, but in the world of SCA reducing noise comes right along with a reduction in detection capability &#8211; it’s unfortunately almost a straight-line correlation.</p>
<p>So if we assume that we’re trying to balance a couple of dials on our theoretical tuner, we might start by reducing or dampening noise – it’s the most obvious place to start, after all. Nobody likes to listen to their favorite FM station through the curtain of hissing and popping that accompanies the act of driving through a major city.  Likewise no developer likes sifting through a long list of bogus detection errors in order to find the hidden gems. But to drag out the analogy, assume that the only way of reducing hiss on your FM signal is to turn down the volume… now you’ve got less hiss, but also less Bruce Springsteen goodness to accompany it.</p>
<p>Balance is what we need here, obviously. Enough Boss to make us ignore the hiss, or to put it in a more SCA-like context, enough interesting bugs to make us ignore the incorrect, or the irrelevant (correct detections on the part of the engine that the developer just doesn’t care about, e.g. low memory conditions in a memory-insensitive environment).</p>
<p>Consider the following simple example that clearly lies &#8220;on the line&#8221;:</p>
<pre><span style="font-size: small;"><span style="font-family: courier new,courier;">    void foo(char* s, int a)</span><span style="font-family: courier new,courier;">
    {
</span><span style="font-family: courier new,courier;">        char* s1 = s;
</span><span style="font-family: courier new,courier;">        if( a &gt; 0 )
</span><span style="font-family: courier new,courier;">            *s1 = 'a';   // potentially use an uninitialized ‘s1’</span><span style="font-family: courier new,courier;">
    }
</span><span style="font-family: courier new,courier;">
    void bar(int m)
    {
        char *s;
        foo(s, m);       // s is not initialized prior to calling ‘foo’
    }</span></span></pre>
<p>So&#8230; to report, or not to report?</p>
<p>Lacking any other information, it is obvious that function ‘foo’ interacts under certain situations (when parameter ‘a’ is positive) with parameter ‘s’ (aliased as local variable ‘s1’). As we have no knowledge about the provenance of parameter ‘s’ when analyzing ‘foo’, however, there’s nothing here to cause a report and so we squirrel away the knowledge of what ‘foo’ does for later use.</p>
<p>When analyzing ‘bar’ we know what ‘foo’ does, and we know we’ve got an uninitialized local pointer, ‘s’. But again we’re lacking enough knowledge to know the valid values, or ranges, that parameter ‘m’ may take. There are definitely a set of circumstances here in which we know a problem will occur (if parameter ‘m’ is positive), and a set of circumstances in which we know a problem will not occur (if parameter ‘m’ is zero or negative) – this much is encoded in the functional behavior of ‘foo’. But is it a defect, or should we filter out the report in favor of providing only those situations in which we can be “sure” the bug not only exists, but can be proven to be exercised?</p>
<p>There’s the art of balance in a nut-shell, and it revolves around the phrase “lacking any other information.” In the ideal world, lacking any restrictions in terms of time, memory or computing power (or indeed actual from-the-wall power, as we have to worry about now), we might defer all such decisions until we categorically know that a particular data value is passed down the call graph far enough to get to ‘foo’. But in the real world of multi-million LOC projects, that approach simply can’t scale.</p>
<p>And so, calling on balance as our friend, we can bias a localized decision to report or not, given that we know to at least one order of approximation that bad things could happen here. Different engines pronounce that bias differently, leading to one of the greatest divides between prevalent solutions.</p>
<p>Now ask yourself, as the developer, is it a worthy report if you know that 10 levels up the call graph there’s a check on what eventually becomes parameter ‘m’ to ensure that it’s never positive? Perhaps you’d automatically classify this as a false positive and, annoyed at the tool, move onto the next report. Or perhaps, seeing the size of the gap in the call graph, you might just choose to code defensively, initializing ‘s’ to NULL in ‘bar’ and adding guard code to &#8216;foo&#8217; because, hey, you never know.</p>
<p>And as we’ve all seen so many times over the years, “you never know” might just as well be written “and so it came to pass&#8230;”</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/06/to-report-or-not-to-report/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top 10 List: Well Traveled Path to Source Code Analysis Success</title>
		<link>http://www.klocwork.com/blog/2011/05/top-10-list-well-traveled-path-to-source-code-analysis-success/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=top-10-list-well-traveled-path-to-source-code-analysis-success</link>
		<comments>http://www.klocwork.com/blog/2011/05/top-10-list-well-traveled-path-to-source-code-analysis-success/#comments</comments>
		<pubDate>Tue, 31 May 2011 14:10:53 +0000</pubDate>
		<dc:creator>Brendan Harrison</dc:creator>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Static Analysis]]></category>
		<category><![CDATA[source code analysis deployment]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1324</guid>
		<description><![CDATA[The Code Integrity folks have developed a lot of best practices on deploying static analysis and have compiled many of them in a solid whitepaper. They include a Top 10 list of what they call &#8220;The Well Traveled Path to Success&#8221;. Below is their (somewhat paraphrased in spots) list. 1. Determine who cares. Who has [...]]]></description>
			<content:encoded><![CDATA[<p>The <a title="Code Integrity Solutions" href="http://codeintegritysolutions.com/" target="_blank">Code Integrity</a> folks have developed a lot of best practices on deploying static analysis and have compiled many of them in a solid <a title="Code Integrity Whitepaper" href="http://developer.klocwork.com/sites/default/files/CodeIntegritySolutions_Whitepaper_Klocwork.pdf" target="_blank">whitepaper</a>. They include a Top 10 list of what they call &#8220;The Well Traveled Path to Success&#8221;. Below is their (somewhat paraphrased in spots) list.</p>
<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/05/TOP-1022.jpg"><img class="alignleft size-medium wp-image-1327" title="TOP-102" src="http://www.klocwork.com/blog/wp-content/uploads/2011/05/TOP-1022-250x300.jpg" alt="Static Analysis Top 10" width="250" height="300" /></a>1. Determine who cares. Who has a vested interest that bugs actually get fixed. How much do they care?</p>
<p>2. Get an expert to tune the solution for your codebase. <a title="Static Analysis Tuning" href="http://developer.klocwork.com/browse/tuning-your-cc-and-java-analysis" target="_blank">Static analysis tuning</a> will maximize defect finding while minimizing false positives. <br />
 3. If possible, pilot with a small group to gain early successes.<br />
 4. Appoint the proper roles, particularly management sponsor, administrator, defect triagers, fixers and verifiers. <br />
 5. Set up the proper process, incentives and consequences. Integrate the SCA tool into your environment. Automate and simplify as much as possible.<br />
 6. Get a team to handpick good, high-priority defects for the team rather than have them sift through potential false positives. <br />
 7. Set up a central resource website that includes simplified documentation, policies, procedures, roles, reports, etc.<br />
 8. Set up various reports like the daily dashboard, top ten list and the “wall of shame”. Make it public. Do a little bit of marketing.<br />
 9. Train and mentor the team providing guidance, support and discipline. Either in-person or <a title="Static Analysis E-Learning" href="http://developer.klocwork.com/members/cbt" target="_parent">static analysis e-learning</a> courses work.<br />
 10. Determine success criteria and measure it. Provide status updates often, work on a <a title="Source Code Analysis ROI" href="http://www.klocwork.com/solutions/roi-calculator/" target="_blank">source code analysis ROI model</a> that works for your organization.</p>
<p>I agree with the general thrust of most of these, but some might be  overkill depending on the size of your deployment. My other quibble is  that many of the recommendations presume a  centralized defect triage  model where you&#8217;d have a central group of code  reviewers sifting though  bug reports.</p>
<p>That&#8217;s a common deployment model,  but we&#8217;re seeing more people  choose to just provide the tool to their  developers via desktop static  analysis. With the possible exception of  your backlog, this will  eliminate (or greatly reduce) the need for a central code review team  that stares at bugs all day long. Regardless, they&#8217;re all good  considerations to at least, well&#8230; consider.</p>
<p>With the launch of the <a title="Klocwork Developer Network" href="http://developer.klocwork.com" target="_blank">Klocwork Developer Network</a>, we&#8217;re making a  deliberate and concerted effort to make many of these kinds of  deployment resources freely available to our customers. I&#8217;ve included  links where appropriate.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/05/top-10-list-well-traveled-path-to-source-code-analysis-success/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Evolution of Source Code Analysis – Part 2: The Early 21st Century</title>
		<link>http://www.klocwork.com/blog/2011/05/the-evolution-of-source-code-analysis-part-2-the-early-21st-century/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=the-evolution-of-source-code-analysis-part-2-the-early-21st-century</link>
		<comments>http://www.klocwork.com/blog/2011/05/the-evolution-of-source-code-analysis-part-2-the-early-21st-century/#comments</comments>
		<pubDate>Thu, 26 May 2011 13:17:27 +0000</pubDate>
		<dc:creator>Todd Landry</dc:creator>
				<category><![CDATA[General Coding]]></category>
		<category><![CDATA[Software Quality]]></category>
		<category><![CDATA[Static Analysis]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[source code analysis]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1313</guid>
		<description><![CDATA[In my last post, I took us back in time to an era of bad fashion, questionable music, legendary television shows, and source code analysis tools that were made specifically for software developers. It was the 1970s. In this post, I fast forward to just after the turn of the century to discuss the next [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://www.klocwork.com/blog/2011/05/the-evolution-of-static-code-analysis-part-1-the-early-years/">last post</a>, I took us back in time to an era of bad fashion, questionable music, legendary television shows, and source code analysis tools that were made specifically for software developers. It was the 1970s. In this post, I fast forward to just after the turn of the century to discuss the next evolution of static analysis tools.</p>
<p><strong>The Early 21</strong><sup><strong>st</strong></sup><strong> Century</strong></p>
<p>Not long after we first viewed hairy-footed <a href="http://en.wikipedia.org/wiki/The_Lord_of_the_Rings">Hobbits</a> on the silver screen, and the sham that was affectionately known as <a href="http://en.wikipedia.org/wiki/Year_2000_problem">Y2K</a>, a new generation of source code analysis tools emerged to cure the errors of the first-generation tools.</p>
<p>These new tools looked beyond the syntactical analysis of previous tools, and instead provided inter-procedural and data-flow analysis. Low hanging fruit was definitely not the target for these tools.</p>
<p>These new techniques were serious&#8211;finding complex defects that could impact code quality and security, and they did that while ensuring that the “noise” (i.e. false positive rate) was greatly reduced compared to the first-generation tools. In addition to local defects, they were now identifying resource management issues, security vulnerabilities, concurrency issues, and so on. These were serious defects that,  if left undetected and unfixed, had the potential for massive problems to the code stream.<a href="http://www.klocwork.com/blog/wp-content/uploads/2011/04/hobbit_feet.jpg"><img class="alignright size-medium wp-image-1314" title="hobbit_feet" src="http://www.klocwork.com/blog/wp-content/uploads/2011/04/hobbit_feet-300x258.jpg" alt="" width="300" height="258" /></a></p>
<p>In order to perform this much deeper analysis, a fundamental change in the analysis techniques had to occur. These engines needed an unfiltered view of the entire code stream, and so they became tightly integrated with the integration build process.</p>
<p>Umm, Houston, we have a problem. If the analysis takes place at integration build time, then that means the analysis is no longer being initiated by the developers. Source code analysis tools became centralized and moved into a more downstream process such as part of a code audit function.</p>
<p>Developers were now being <em>told</em> they created bugs well after they actually checked in the code. They had already moved onto something entirely different, so now bringing them these day-old, or week-old defects was certainly not the most productive use of their time. It is well documented that the earlier you find defects in your code, the more cost effective it is to fix them, so you can clearly see the problems with these second-generation tools.</p>
<p>If only there was a way to bring these second-generation analysis capabilities to the developer desktop. More about that in my next entry.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/05/the-evolution-of-source-code-analysis-part-2-the-early-21st-century/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>And the word of the day is… docragination</title>
		<link>http://www.klocwork.com/blog/2011/05/and-the-word-of-the-day-is-docragination/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=and-the-word-of-the-day-is-docragination</link>
		<comments>http://www.klocwork.com/blog/2011/05/and-the-word-of-the-day-is-docragination/#comments</comments>
		<pubDate>Thu, 19 May 2011 12:42:25 +0000</pubDate>
		<dc:creator>Helen Abbott</dc:creator>
				<category><![CDATA[Agile Development]]></category>
		<category><![CDATA[User Documentation]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[technical writing]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1299</guid>
		<description><![CDATA[I came to the practice of procrastination late in life. I was always one of those annoying people who arrived for appointments early, handed in assignments early, went to bed early. Becoming a full-time working parent drove me to the dark side. Now I&#8217;m routinely late &#8212; late for exercise classes, late going to bed, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/04/procrastination1.png"><img class="size-medium wp-image-1301  alignleft" title="procrastination" src="http://www.klocwork.com/blog/wp-content/uploads/2011/04/procrastination1-300x237.png" alt="Procrastination: I'll find a picture for it later" width="300" height="237" /></a></p>
<p>I came to the practice of procrastination late in life. I was always one of those annoying people who arrived for appointments early, handed in assignments early, went to bed early.</p>
<p>Becoming a full-time working parent drove me to the dark side.</p>
<p>Now I&#8217;m routinely late &#8212; late for exercise classes, late going to bed, late getting the kids to daycare.</p>
<p>My forgetfulness factor has increased about 26-fold too. I&#8217;ve always been a list-maker, but now I have a few sayings that my husband is sick of: If it&#8217;s not in my calendar, it&#8217;s not getting done. If it&#8217;s not on the grocery list, it&#8217;s not going to show up in the fridge.</p>
<p>My work equivalent: If it&#8217;s not in <a title="XPlanner" href="http://www.xplanner.org/" target="_blank">XPlanner</a>, it&#8217;s not getting done.</p>
<p>However, I&#8217;ve also discovered that adding tasks to XPlanner is a necessary but not sufficient condition for something getting done. Ever so occasionally, I&#8217;ll realize that a task in my slightly overlong list of tasks for the iteration should have been done&#8230; yesterday.</p>
<p>In my pre-kid years (which incidentally and unfortunately coincided with the days of larger doc teams), that just didn&#8217;t happen. I had sufficient brain space to accommodate what needed to be done.</p>
<p>My colleague <a title="Patti Murphy's Kloctalk posts" href="http://www.klocwork.com/blog/author/patti-murphy/" target="_blank">Patti</a> and I decided to elevate this practice of procrastination in agile documentation by giving it a name:</p>
<p><strong>DOCRAGINATION.</strong></p>
<p>Fortunately, in my latest slip into docragination, I got away with it: I wasn&#8217;t the only reason for another software build.</p>
<p>As I get older, I&#8217;m growing more certain that procrastination in general is not always a bad thing. There&#8217;s something to be said for waiting, listening, processing &#8212; even sleeping on it &#8212; instead of rushing in and finishing.</p>
<p>Patti just reminded me of another of my annoying sayings: What doesn&#8217;t get documented today won&#8217;t have to be revised later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/05/and-the-word-of-the-day-is-docragination/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Evolution of Static Code Analysis – Part 1: The Early Years</title>
		<link>http://www.klocwork.com/blog/2011/05/the-evolution-of-static-code-analysis-part-1-the-early-years/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=the-evolution-of-static-code-analysis-part-1-the-early-years</link>
		<comments>http://www.klocwork.com/blog/2011/05/the-evolution-of-static-code-analysis-part-1-the-early-years/#comments</comments>
		<pubDate>Tue, 17 May 2011 13:45:09 +0000</pubDate>
		<dc:creator>Todd Landry</dc:creator>
				<category><![CDATA[General Coding]]></category>
		<category><![CDATA[General Industry]]></category>
		<category><![CDATA[Static Analysis]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[source code analysis]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1306</guid>
		<description><![CDATA[Our marketing people here at Klocwork like to see me racking up frequent flyer miles and expending CO2 at roadshows, conferences and tradeshows. Whenever I’m out speaking, I always like to gauge audience familiarity with Static Code Analysis. I’m happy to say that SCA knowledge has definitely increased over the years, but it is still [...]]]></description>
			<content:encoded><![CDATA[<p>Our marketing people here at Klocwork like to see me racking up frequent flyer miles and expending CO2 at roadshows, conferences and tradeshows. Whenever I’m out speaking, I always like to gauge audience familiarity with Static Code Analysis.</p>
<p>I’m happy to say that SCA knowledge has definitely increased over the years, but it is still not up to levels enjoyed by unit testing or integration testing.</p>
<p>What I plan to do over the next three weeks is to provide you with a history lesson on how Static Code Analysis has evolved over the past few decades (yes, it has been around that long!). The three different eras I will be addressing are The Early Years, The Early 21<sup>st</sup> Century, and  The Present Day.</p>
<p><strong><em>The Early Years</em></strong></p>
<p>As I mentioned earlier, Static Code Analysis has actually been around since the time of <a href="http://en.wikipedia.org/wiki/Bell-bottoms">bell bottoms</a>, <a href="http://www.youtube.com/watch?v=JlzlNpttvVM">disco music</a>, and <a href="http://www.spaceinvaders.de/">Space Invaders</a> (check out the Space Invaders link)&#8211;yes, the good ole 1970s. Who out there has heard of <a href="http://en.wikipedia.org/wiki/Lint_(software)">Lint</a> (and no, I’m not talking about the fluff coming from your old bell bottoms pockets)?</p>
<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/04/space-invaders-videogame.jpg"><img class="alignright size-medium wp-image-1312" title="space-invaders-videogame" src="http://www.klocwork.com/blog/wp-content/uploads/2011/04/space-invaders-videogame-173x300.jpg" alt="" width="173" height="300" /></a></p>
<p>Lint was one of these first-generation SCA tools introduced in the late 70s. These tools targeted low hanging fruit in C code, such as missing or extra semi-colons, missing curlicues, potentially dangerous <a href="http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.sqls.doc/sqls169.htm">implicit casts</a>, and so on.</p>
<p>These tools were closely integrated with the compile and link process, and so this <em>seemed</em> like the best time to show its errors and warnings, while the developer was actually “in process” and fixing problems found by the compiler. Since these tools delivered its warnings at compile time, it quickly became a tool that was adopted and owned by the developers themselves.</p>
<p>Life was good. Well, until the bugs that were being found were deemed to be relatively trivial or completely erroneous (the dreaded false positive). The problem was that these tools were only able to see one file at a time, but for accurate static analysis there is a strong need to know everything that&#8217;s going on within the entire stream.</p>
<p>Without that vision of the entire stream, no matter how sophisticated the analysis tools are, they will make incorrect assumptions most of the time. Because of these inaccuracies, these first-generation tools never gained the widespread acceptance of software developers.</p>
<p>Next up will be a look at static analysis tools during a time when “<a href="http://www.youtube.com/watch?v=ikkg4NobV_w">Whassssuuuupp</a>” became a household term.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/05/the-evolution-of-static-code-analysis-part-1-the-early-years/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IDE vs text editor</title>
		<link>http://www.klocwork.com/blog/2011/05/ide-vs-text-editor/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=ide-vs-text-editor</link>
		<comments>http://www.klocwork.com/blog/2011/05/ide-vs-text-editor/#comments</comments>
		<pubDate>Tue, 10 May 2011 13:44:26 +0000</pubDate>
		<dc:creator>Alen Zukich</dc:creator>
				<category><![CDATA[General Coding]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[Static Analysis]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1303</guid>
		<description><![CDATA[I&#8217;m sure this topic has been discussed a million times, but hey, here we go again.  A recent question came up on whether people liked their experience of Eclipse vs. Visual Studio.  Of course this brought up the advantages of one versus the other.  But is that really a fair comparison? It really depends.  What [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sure this topic has been discussed a million times, but hey, here we go again.  A recent <a href="http://www.linkedin.com/groupItem?view=&amp;srchtype=discussedNews&amp;gid=1973349&amp;item=37110180&amp;type=member&amp;trk=eml-anet_dig-b_pd-ttl-cn" target="_blank">question</a> came up on whether people liked their experience of Eclipse vs. Visual Studio.  Of course this brought up the advantages of one versus the other.  But is that really a fair comparison? It really depends.  What type of application are you building &#8212; a native Windows application?  Surely going with Visual Studio makes sense. But if the goal is cross-platform, then you might look at Eclipse.</p>
<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/04/Beginner-039-s-Vi-Editor-Guide-2.png"><img class="size-full wp-image-1305 alignleft" title="Beginner-039-s-Vi-Editor-Guide-2" src="http://www.klocwork.com/blog/wp-content/uploads/2011/04/Beginner-039-s-Vi-Editor-Guide-2.png" alt="" width="400" height="330" /></a>Glad to see people are thinking about IDEs, but what really intrigues me about this conversation of one IDE versus another is that someone always has to add their two cents about the ancient text editors of the world.   Something like &#8220;real programmers use vi&#8221;.  Hold the phone.  Are we talking about the same text editor that requires you to memorize a gazillion key bindings?</p>
<p>I don&#8217;t get this.  I understand legacy use, as vi was the only available built-in text editor at the time and still is the only choice of hackers today.  But times have changed.  Anyone I&#8217;ve talked to who is using vi (or other known text editors like emacs) always seems very proud of it.  Maybe knowing how to use such a complex tool provides some self-worth.  I just don&#8217;t know.  Seems like it would be the same as me bragging about my portable Walkman or the 8-track player in my car.</p>
<p>Don&#8217;t the features of Visual Studio or Eclipse make you faster?  With a click of a button you can refactor your code.  With simple auto-completion the IDE eliminates simple typing (or even mistakes).  Plus with built-in tools for static analysis, test generation, etc., what are you waiting for?</p>
<p>So you vi/vim/emacs coders out there &#8212; tell me why on earth you are sticking with it. What makes you a better programmer using vi/vim or emacs?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/05/ide-vs-text-editor/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Stack smashing</title>
		<link>http://www.klocwork.com/blog/2011/05/stack-smashing/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=stack-smashing</link>
		<comments>http://www.klocwork.com/blog/2011/05/stack-smashing/#comments</comments>
		<pubDate>Tue, 03 May 2011 19:41:24 +0000</pubDate>
		<dc:creator>Alen Zukich</dc:creator>
				<category><![CDATA[Nasty Bugs]]></category>
		<category><![CDATA[buffer overflows]]></category>
		<category><![CDATA[memory overflows]]></category>
		<category><![CDATA[stack corruption]]></category>
		<category><![CDATA[stack smashing]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1316</guid>
		<description><![CDATA[A while ago I talked about memory overflows.  Now in this latest instalment, as we look at more interesting bugs, I&#8217;ve come across a new example.  Here is a situation described by a customer as &#8220;stack smashing&#8221;, which occurs when you copy a string of unknown length into a fixed buffer size. #include &#60;stdio.h&#62;; void [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago I talked about <a href="http://www.klocwork.com/blog/2011/04/memory-overflows/" target="_blank">memory overflows</a>.  Now in this latest instalment, as we look at more interesting bugs, I&#8217;ve come across a new example.  Here is a situation described by a customer as &#8220;stack smashing&#8221;, which occurs when you copy a string of unknown length into a fixed buffer size.</p>
<pre>
<pre class="brush: cpp; title: ;">#include &lt;stdio.h&gt;;

void foo(char * v) {
    char buffer[10];
    if(v != NULL)
   {
            memcpy(buffer, v,strlen(v));
    }
}

int main (int argc, char ** argv)
{
    foo(argv[1]);
    foo(&quot;the longest string you can find&quot;);
    return 0;
}</pre>
</pre>
<p>Just like the <a href="http://www.klocwork.com/blog/2011/04/memory-overflows/" target="_blank">memory overflow</a> post this is another form of a <a href="http://en.wikipedia.org/wiki/Buffer_overflow" target="_blank">buffer overflow</a>.  So there you have it, just more terminology to describe bad things in your code.  <a href="http://www.klocwork.com/blog/author/gwyn-fisher/" target="_blank">Gwyn</a> promises to give a follow up to these posts with some details on how this general area (stack corruption, tainted sources, etc.) can be exploited.  Can&#8217;t wait to see that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/05/stack-smashing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Toughen up your code with software security best practices</title>
		<link>http://www.klocwork.com/blog/2011/04/toughen-up-your-code-with-software-security-best-practices/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=toughen-up-your-code-with-software-security-best-practices</link>
		<comments>http://www.klocwork.com/blog/2011/04/toughen-up-your-code-with-software-security-best-practices/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 14:06:47 +0000</pubDate>
		<dc:creator>Patti Murphy</dc:creator>
				<category><![CDATA[Coding Standards]]></category>
		<category><![CDATA[General Coding]]></category>
		<category><![CDATA[General Industry]]></category>
		<category><![CDATA[Software Security]]></category>
		<category><![CDATA[Microsoft Security Development Lifecycle]]></category>
		<category><![CDATA[OWASP]]></category>
		<category><![CDATA[SDL]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1302</guid>
		<description><![CDATA[Crying into your wadded Kleenex about how your vulnerabilities were exploited may make for compelling TV, but when it comes to software security, they’ll cost you a lot more than your personal dignity. Or maybe they&#8217;ll cost you millions of dollars in lost business and your personal dignity. Why not toughen up your code by [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.klocwork.com/blog/wp-content/uploads/2011/04/cope-crying-baby-800x800.jpg"><img class="alignright size-full wp-image-1309" title="cope-crying-baby-800x800" src="http://www.klocwork.com/blog/wp-content/uploads/2011/04/cope-crying-baby-800x800.jpg" alt="" width="360" height="239" /></a>Crying into your wadded Kleenex about how your vulnerabilities were exploited may make for compelling TV, but when it comes to software security, they’ll cost you a lot more than your personal dignity. Or maybe they&#8217;ll cost you millions of dollars in lost business <em>and </em>your personal dignity.</p>
<p>Why not toughen up your code by implementing software security best practices that prevent or mitigate the risks?</p>
<p>That’s why you should head on over to the<a href="http://developer.klocwork.com/browse/free-courses-security-innovation" target="_blank"> Klocwork Developer Network</a> and check out the free eLearning courses provided by <a href="https://teamprofessor.securityinnovation.com/ed/Portal/default.asp?location=&amp;selectedIndex=1-" target="_blank">Security Innovation</a>, an industry leader in software security and cryptography. To view learning resources, just log in or register.</p>
<p>Here&#8217;s a brief description of each course:</p>
<ul>
<li><a href="http://developer.klocwork.com/members/security-innovations/owasp-top-ten-threats-and-mitigations" target="_blank"><strong> </strong></a><strong><a href="http://developer.klocwork.com/members/security-innovations/owasp-top-ten-threats-and-mitigations">OWASP Top 10 – Threats and Mitigations</a> </strong></li>
</ul>
<p style="padding-left: 30px;">Learn strategies and best practices for understanding, identifying and mitigating the risk of vulnerabilities and attacks within the OWASP Top 10.</p>
<ul>
<li><a href="http://developer.klocwork.com/members/security-innovations/intro-microsoft-security-development-lifecycle-sdl" target="_blank"><strong>Intro to the Microsoft Security Development Lifecycle (SDL) </strong></a></li>
</ul>
<p style="padding-left: 30px;">The Security Development Lifecycle (SDL), a key security engineering process that was spawned from Microsoft’s Trustworthy Computing Initiative. Learn the necessary steps to meet SDL requirements, and identify the appropriate tools required by the SDL.</p>
<ul>
<li><a href="http://developer.klocwork.com/members/security-innovations/cross-site-scripting-aspnet" target="_blank"><strong>Intro to XSS – Asp.Net examples </strong></a></li>
</ul>
<p style="padding-left: 30px;">Learn to understand the mechanisms behind cross-site scripting vulnerabilities, describe cross-site scripting vulnerabilities and their consequences, and apply secure coding best practices to prevent cross-site scripting vulnerabilities.</p>
<ul>
<li><a href="http://developer.klocwork.com/members/security-innovations/cross-site-scripting-jsp" target="_blank"><strong>Intro to XSS – Java </strong></a></li>
</ul>
<p style="padding-left: 30px;">Learn to understand the mechanisms behind cross-site scripting vulnerabilities, describe cross-site scripting vulnerabilities and their consequences, and apply secure coding best practices to prevent cross-site scripting vulnerabilities.</p>
<p style="padding-left: 30px;">Have fun, code safely and put that Kleenex away (unless it&#8217;s allergy season).</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves /> <w:TrackFormatting /> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF /> <w:LidThemeOther>EN-CA</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> <w:SplitPgBreakAndParaMark /> <w:DontVertAlignCellWithSp /> <w:DontBreakConstrainedForcedTables /> <w:DontVertAlignInTxbx /> <w:Word11KerningPairs /> <w:CachedColBalance /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math" /> <m:brkBin m:val="before" /> <m:brkBinSub m:val="&#45;-" /> <m:smallFrac m:val="off" /> <m:dispDef /> <m:lMargin m:val="0" /> <m:rMargin m:val="0" /> <m:defJc m:val="centerGroup" /> <m:wrapIndent m:val="1440" /> <m:intLim m:val="subSup" /> <m:naryLim m:val="undOvr" /> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"   DefSemiHidden="true" DefQFormat="false" DefPriority="99"   LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Normal" /> <w:LsdException Locked="false" Priority="9" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="heading 1" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /> <w:LsdException Locked="false" Priority="39" Name="toc 1" /> <w:LsdException Locked="false" Priority="39" Name="toc 2" /> <w:LsdException Locked="false" Priority="39" Name="toc 3" /> <w:LsdException Locked="false" Priority="39" Name="toc 4" /> <w:LsdException Locked="false" Priority="39" Name="toc 5" /> <w:LsdException Locked="false" Priority="39" Name="toc 6" /> <w:LsdException Locked="false" Priority="39" Name="toc 7" /> <w:LsdException Locked="false" Priority="39" Name="toc 8" /> <w:LsdException Locked="false" Priority="39" Name="toc 9" /> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /> <w:LsdException Locked="false" Priority="10" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Title" /> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /> <w:LsdException Locked="false" Priority="11" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /> <w:LsdException Locked="false" Priority="22" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Strong" /> <w:LsdException Locked="false" Priority="20" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /> <w:LsdException Locked="false" Priority="59" SemiHidden="false"    UnhideWhenUsed="false" Name="Table Grid" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /> <w:LsdException Locked="false" Priority="1" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 1" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 1" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 1" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /> <w:LsdException Locked="false" Priority="34" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /> <w:LsdException Locked="false" Priority="29" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Quote" /> <w:LsdException Locked="false" Priority="30" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 1" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 1" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 2" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 2" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 2" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 2" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 2" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 3" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 3" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 3" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 3" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 3" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 4" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 4" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 4" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 4" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 4" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 5" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 5" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 5" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 5" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 5" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 6" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 6" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 6" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 6" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 6" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /> <w:LsdException Locked="false" Priority="19" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /> <w:LsdException Locked="false" Priority="21" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /> <w:LsdException Locked="false" Priority="31" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /> <w:LsdException Locked="false" Priority="32" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /> <w:LsdException Locked="false" Priority="33" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Book Title" /> <w:LsdException Locked="false" Priority="37" Name="Bibliography" /> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <mce:style><!   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0cm 5.4pt 0cm 5.4pt; 	mso-para-margin-top:0cm; 	mso-para-margin-right:0cm; 	mso-para-margin-bottom:10.0pt; 	mso-para-margin-left:0cm; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} --> <!--[endif]--></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p class="MsoNormal">Crying into your wadded Kleenex about how your vulnerabilities were exploited may make for compelling TV, but when it comes to software security, they’ll cost you a lot more than your personal dignity.</p>
<p class="MsoNormal">That’s why you should head on over to our Developer Network and check out free eLearning security courses provided by Security Innovations, an industry leader in software security and cryptography.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">You can wail and gnash your teeth over your exploited vulnerabilitiesSoftware security isn’t just finding your soft spots that attackers can exploit, it’s preventing them in the first place.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">OWASP Top 10 – Threats and Mitigations</p>
<p class="MsoNormal">There are hundreds of risks to web applications.<span> </span>Each year, the Open Web Application Security Project (OWASP) publishes its Top Ten list, representing its opinion of the most critical web application security flaws. Mitigating these flaws will help an organization greatly reduce the risk of a web application being compromised.<span> </span>Regulatory bodies, including PCI-DSS and the Federal Trade Commission, recommend addressing the OWASP Top 10 as part of an organization’s best practices.<span> </span>This course will provide personnel with strategies and best practices for understanding, identifying and mitigating the risk of vulnerabilities and attacks within the OWASP Top 10. Prerequisite: none.</p>
<p class="MsoNormal">Intro to the Microsoft Security Development Lifecycle (SDL)</p>
<p class="MsoNormal">This course introduces the Security Development Lifecycle (SDL), a key security engineering process that was spawned from Microsoft’s Trustworthy Computing Initiative.<span> </span>Students will learn how to design and implement products that meet an organization’s security needs.<span> </span>Upon completion of this course, the participant will be able to identify the benefits of the Security Development Lifecycle, recognize the importance of the Final Security Review, follow the necessary steps to meet SDL requirements, and identify the appropriate tools required by the SDL.<span> </span>Prerequisite: basic knowledge of the software development lifecycle.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Intro to XSS – Asp.Net examples</p>
<p class="MsoNormal">In this course, students will learn to understand the mechanisms behind cross-site scripting vulnerabilities, describe cross-site scripting vulnerabilities and their consequences, and apply secure coding best practices to prevent cross-site scripting vulnerabilities.<span> </span>Prerequisite:<span> </span>Basic knowledge of Web technologies, ASP.NET, and C# programming language.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Intro to XSS – Java</p>
<p class="MsoNormal">In this course, students will learn to understand the mechanisms behind cross-site scripting vulnerabilities, describe cross-site scripting vulnerabilities and their consequences, and apply secure coding best practices to prevent cross-site scripting vulnerabilities.<span> </span>Prerequisite:<span> </span>Basic knowledge of Web technologies, and Java Server Pages (JSP).</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2011/04/toughen-up-your-code-with-software-security-best-practices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 0.534 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-02-08 08:45:43 --><!-- Compression = gzip -->

