Fix possible memory overflow and remove DEBUG_MAX_BUFFER
Merge pull request #1 from clibs/fix/possible-overflow

Fix possible memory overflow and remove DEBUG_MAX_BUFFER