title: Security considerations behind this code snippet in C
body: <p>I found this code on git and wanted to use it, but someone made a comment about a security bug in it. I don't seem to identify it:</p>
  
  <pre><code>int32_t read_arrbuff(FILE *f, uint32_t *arrmap) {
    int32_t i = 0, n_map;
    fread(&amp;n_map, sizeof(n_map), 1, f);
    if (n_map &gt; 256)
      return -1;
    while (n_map--) {
      fread(&amp;arrmap[i++], sizeof(uint32_t), 1, f);
    }
    return n_map;
  }
  </code></pre>