title: "Program received signal SIGABRT, Aborted" - Why?
body: <p>Please help me understand - why am I getting this run-time error:</p>
  
  <blockquote>
    <p>*** stack smashing detected ***:<br>
    Program received signal SIGABRT, Aborted.</p>
  </blockquote>
  
  <p>for the following code : </p>
  
  <pre><code>#define WORD_SIZE   (sizeof(int))
  #define FLOOR_MASK  0xfffffffc
  
  
  static void SetVal(void* _block, int _size)
  {
      *(int*)_block = _size;
  }
  
  void BufferInit(void* _buffer, size_t _totalSize)
  {
    int alignedSize;
  
    assert(_buffer);
  
    /* align _totalSize to be WORD_SIZE multiple */
    alignedSize = _totalSize &amp; FLOOR_MASK;
  
    /* mark end of buffer */
    SetVal(_buffer + alignedSize, END_VAL);
  }
  
  int main()
  {
      Byte buffer[36];
  
      BufferInit(buffer, 37);
  
      return 0;
  }
  </code></pre>
  
  <p>P.S: The error occurs at the end of the run (on line <code>"return 0;"</code> ).</p>
  
  <p>Thanks.</p>