- lots more code cleanup, using safe buffer size code to avoid buffer overflows

This commit is contained in:
Mark Vejvoda
2012-10-19 01:31:20 +00:00
parent 39191dc11e
commit 011e0263b0
68 changed files with 906 additions and 1200 deletions

View File

@@ -915,8 +915,8 @@ void Pixmap2D::init(int w, int h, int components) {
deletePixels();
if(getPixelByteCount() <= 0 || (h <= 0 || w <= 0 || components <= 0)) {
char szBuf[1024];
sprintf(szBuf,"Invalid pixmap dimensions for [%s], h = %d, w = %d, components = %d\n",path.c_str(),h,w,components);
char szBuf[8096];
snprintf(szBuf,8096,"Invalid pixmap dimensions for [%s], h = %d, w = %d, components = %d\n",path.c_str(),h,w,components);
throw megaglest_runtime_error(szBuf);
}
pixels= new uint8[(std::size_t)getPixelByteCount()];