summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleo2011-08-30 23:15:18 +0000
committerleo2011-08-30 23:15:18 +0000
commitc0c37e54a521b8d8da8d1d3c07451e483e41491f (patch)
tree06d8e272a43459ce91df9bf8c2b9f6118456beb8
parent6387de22a4cc4a6ae69b7eb932d6f14de26272ff (diff)
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
-rw-r--r--common/project.cpp8
-rw-r--r--win/Piecebar.cpp2
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';