Fixed possible exploit. The buffer length is now compared