Bugfix: Fix possible buffer overflow (#901)