Fix buffer overflow

feature/pre-code-move
kaetemi 5 years ago committed by Jan Boon
parent d934f5769a
commit 174aff62d7

@ -16,6 +16,7 @@
#include <map>
#include <vector>
#include <sstream>
#include "nel/pacs/collision_mesh_build.h"
#include "nel/pacs/local_retriever.h"
@ -278,24 +279,26 @@ void linkExteriorToInterior(CLocalRetriever &lr)
for (i=0; i<bchains.size(); ++i)
{
static char buf[512], w[256];
char w[256];
std::stringstream ss;
const CChain &chain = chains[bchains[i]];
sprintf(buf, "Border chain %d: chain=%d ", i, bchains[i]);
sprintf(w, "Border chain %d: chain=%d ", i, bchains[i]);
ss << w;
uint och;
for (och=0; och<chain.getSubChains().size(); ++och)
{
const COrderedChain3f &ochain = ochains[chain.getSubChain(och)];
sprintf(w, "subchain=%d", chain.getSubChain(och));
strcat(buf, w);
ss << w;
uint v;
for (v=0; v<ochain.getVertices().size(); ++v)
{
sprintf(w, " (%.2f,%.2f)", ochain[v].x, ochain[v].y);
strcat(buf, w);
ss << w;
}
}
nlinfo("%s", buf);
nlinfo("%s", ss.str().c_str());
}
}

Loading…
Cancel
Save