title: Stack corruption using sscanf
body: <p>I have the following code to convert 2 hex digits to a byte value:</p>
  
  <pre><code>const char* data= "Some hex string";
  unsigned char temp=' ';
  sscanf(data, "%2hhx", &amp;temp);
  </code></pre>
  
  <p>When running it I get a run time exception, saying </p>
  
  <blockquote>
    <p>stack around variable temp is corrupted</p>
  </blockquote>
  
  <p>What am I doing wrong? AFAIK <code>2hhx</code> should convert two bytes to one...</p>