Fixed bug reported by Julian Foad:

While investigating, I found that SGPropertyNode::getPath returns a
(char *) pointer to the character data of a string on its stack,
i.e. to undefined memory after it returns.  I remember someone was
changing strings to char* for efficiency.  Perhaps this bug was
introduced then.  I'll include a patch for it with my eventual patch
for the above, unless someone beats me to it.  I don't think it
affects any existing callers: they all want a string anyway.
This commit is contained in:
david
2002-06-28 16:56:14 +00:00
parent b201383a80
commit 9737c0c4dd

View File

@@ -931,7 +931,8 @@ SGPropertyNode::getPath (bool simplify) const
sprintf(buffer, "[%d]", _index);
path += buffer;
}
return path.c_str();
strncpy(_buffer, path.c_str(), MAX_STRING_LEN);
return _buffer;
}
SGPropertyNode::Type