From 79d5bf66a760737514e12824afbf8cc6995c5cc2 Mon Sep 17 00:00:00 2001 From: ehofman Date: Mon, 20 Oct 2003 09:41:26 +0000 Subject: [PATCH] Safety updates --- simgear/compatibility/sstream | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/simgear/compatibility/sstream b/simgear/compatibility/sstream index 5d023eac..cf6ac678 100644 --- a/simgear/compatibility/sstream +++ b/simgear/compatibility/sstream @@ -17,8 +17,11 @@ namespace std { ostringstream(const string &str, int=ios::out) { sstr = new ostrstream((char *)str.c_str(), str.size(), ios::out); } - ~ostringstream() { delete sstr; } - std::string str() { return std::string(sstr->str()); } + ~ostringstream() { delete sstr->str(); delete sstr; } + std::string str() { + std::string _str = std::string(sstr->str()); _str.append('\0'); + return _str; + } int pcount() { return sstr->pcount(); } };