title: Initializing unsigned int returned by sscanf
body: <p>The variable (a, r, g, b) will contain an arbitrary value left from earlier computations.</p>
  
  <pre><code>unsigned int parse_colour( const char *str )
  {
      unsigned int a, r, g, b;
      int ret;
  
      if( !str || !*str ) return 0;
  
      if( strlen( str ) == 1 ) return (unsigned int)atoi( str );
  
      if( str[0] == '0' &amp;&amp; str[1] == 'x' ) {
              ret = sscanf( str, "0x%x", &amp;a );
      } else {
              ret = sscanf( str, "%u %u %u %u", &amp;a, &amp;r, &amp;g, &amp;b );
      }
  
      if( ret == 1 ) {
              return a;
      } else if( ret == 2 ) {
              return 0xff000000 | ( (a &amp; 0xff) &lt;&lt; 8 ) | (r &amp; 0xff);
      } else if( ret == 3 ) {
              return 0xff000000 | ( (a &amp; 0xff) &lt;&lt; 16 ) | ( (r &amp; 0xff) &lt;&lt; 8 ) | ( g &amp; 0xff);
      } else if( ret == 4 ) {
              return ( (a &amp; 0xff) &lt;&lt; 24 ) | ( (r &amp; 0xff) &lt;&lt; 16 ) | ( ( g &amp; 0xff) &lt;&lt; 8 ) | (b &amp; 0xff);
      }
  
      return 0;
  }
  </code></pre>
  
  <p>The code uses a variable that has not been initialized, leading to unpredictable or unintended results. </p>
  
  <p>False positive?</p>