Fix for buffer overflow, WebRTC issue 1196
Review URL: https://webrtc-codereview.appspot.com/998004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3286 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
96dc6270d4
commit
ddebc17bee
@ -14,6 +14,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -53,9 +54,9 @@ std::string ChoiceBuilder::MakeHumanReadableOptions() {
|
|||||||
std::string result = "";
|
std::string result = "";
|
||||||
Choices::const_iterator iterator = choices_.begin();
|
Choices::const_iterator iterator = choices_.begin();
|
||||||
for (int number = 1; iterator != choices_.end(); ++iterator, ++number) {
|
for (int number = 1; iterator != choices_.end(); ++iterator, ++number) {
|
||||||
char buffer[128];
|
std::ostringstream os;
|
||||||
sprintf(buffer, "\n %d. %s", number, (*iterator).c_str());
|
os << "\n " << number << ". " << (*iterator).c_str();
|
||||||
result += buffer;
|
result += os.str();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user