From c0de8dd04d2704eefb4b5d11838c810f31d21bfe Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 20 Apr 2018 06:54:11 +0200 Subject: LILLIPUT: Fix unsafe read of string reported by coverity --- engines/lilliput/detection.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/lilliput/detection.cpp b/engines/lilliput/detection.cpp index 466c89e362..eb65ad2d64 100644 --- a/engines/lilliput/detection.cpp +++ b/engines/lilliput/detection.cpp @@ -227,9 +227,11 @@ SaveStateDescriptor LilliputMetaEngine::querySaveMetaInfos(const char *target, i } uint32 saveNameLength = file->readUint16BE(); - char saveName[256]; - file->read(saveName, saveNameLength); - saveName[saveNameLength] = 0; + Common::String saveName; + for (uint32 i = 0; i < saveNameLength; ++i) { + char curChr = file->readByte(); + saveName += curChr; + } SaveStateDescriptor desc(slot, saveName); -- cgit v1.2.3