From bbc4cf575161698798a824dbb1145f79bcd0370f Mon Sep 17 00:00:00 2001 From: Christian Beer Date: Tue, 10 Nov 2015 16:56:44 +0100 Subject: [PATCH] VboxWrapper: prevent use after free in FloppyIOException see http://blog.sensecodons.com/2013/04/dont-let-stdstringstreamstrcstr-happen.html for details fixes CID 34536 found by Coverity --- samples/vboxwrapper/floppyio.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/vboxwrapper/floppyio.h b/samples/vboxwrapper/floppyio.h index 4bdc7b3a1c..5cdd702cfe 100644 --- a/samples/vboxwrapper/floppyio.h +++ b/samples/vboxwrapper/floppyio.h @@ -170,7 +170,8 @@ namespace FloppyIONS { virtual const char* what() const throw() { static std::ostringstream oss (std::ostringstream::out); oss << this->message << ". Error code = " << this->code; - return oss.str().c_str(); + std::string tmp = oss.str(); + return tmp.c_str(); } // Change the message and return my instance