title: C: What is a/example of a buffer underflow?
body: <p>I know what a <em>buffer overflow</em> is. I have no idea however what a <em>buffer underflow</em> is.</p>
  
  <p>I am guessing it is when a specific buffer receives instead of an overflow of bytes, an underflow of bytes.</p>
  
  <pre><code>char buffer[8];
  fgets(buffer, sizeof(buffer), stdin);
  </code></pre>
  
  <p>The above would give no error.</p>
  
  <pre><code>char buffer_overflow[8];
  fgets(buffer_overflow, 16, stdin);
  </code></pre>
  
  <p>The above would result in a <em>buffer overflow</em> if the user input was, for example "deutschland".</p>
  
  <p>Could I get an example in code, what a <em>buffer underflow</em> is?</p>