Fixed incorrect buffer size in several places

Use correct sizes instead of sizeof(pointer)