From c0c37e54a521b8d8da8d1d3c07451e483e41491f Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 30 Aug 2011 23:15:18 +0000 Subject: Fixed buffer overflow errors caused by long file names. git-svn-id: http://svn.leocad.org/branches/leocad-0.75@981 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- common/project.cpp | 8 ++++---- win/Piecebar.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/project.cpp b/common/project.cpp index 4a1420e..bc0b09a 100644 --- a/common/project.cpp +++ b/common/project.cpp @@ -522,7 +522,7 @@ bool Project::FileLoad(File* file, bool bUndo, bool bMerge) } else { - char name[9]; + char name[LC_PIECE_NAME_LEN]; float pos[3], rot[3], param[4]; unsigned char color, step, group; @@ -1079,9 +1079,9 @@ void Project::FileReadLDraw(File* file, Matrix* prevmat, int* nOk, int DefColor, *ptr = 0; // See if it's a piece in the library - if (strlen(tmp) < 9) + if (strlen(tmp) < LC_PIECE_NAME_LEN) { - char name[9]; + char name[LC_PIECE_NAME_LEN]; strcpy(name, tmp); PieceInfo* pInfo = lcGetPiecesLibrary()->FindPieceInfo(name); @@ -4735,7 +4735,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam) file->Read(&i, sizeof(i)); while (i--) { - char name[9]; + char name[LC_PIECE_NAME_LEN]; Piece* pPiece = new Piece(NULL); pPiece->FileLoad(*file, name); PieceInfo* pInfo = lcGetPiecesLibrary()->FindPieceInfo(name); diff --git a/win/Piecebar.cpp b/win/Piecebar.cpp index 6c949cd..87e76ae 100644 --- a/win/Piecebar.cpp +++ b/win/Piecebar.cpp @@ -830,7 +830,7 @@ void CPiecesBar::SelectPiece(const char* Category, PieceInfo* Info) PieceInfo* Parent; // Find the parent of this patterned piece and expand it. - char ParentName[9]; + char ParentName[LC_PIECE_NAME_LEN]; strcpy(ParentName, Info->m_strName); *strchr(ParentName, 'P') = '\0'; -- cgit v1.2.3