Fixed a segfault on array that was too small when setting Tesseract base dir

This commit is contained in:
Matt Hill
2014-02-04 23:02:07 -06:00
parent fe0d58aeb9
commit 9de4fb4b73

View File

@@ -31,7 +31,7 @@ OCR::OCR(Config* config)
tesseract=new TessBaseAPI(); tesseract=new TessBaseAPI();
// Tesseract requires the prefix directory to be set as an env variable // Tesseract requires the prefix directory to be set as an env variable
vector<char> tessdataPrefix(config->getTessdataPrefix().size()); vector<char> tessdataPrefix(config->getTessdataPrefix().size() + 1);
strcpy(tessdataPrefix.data(), config->getTessdataPrefix().c_str()); strcpy(tessdataPrefix.data(), config->getTessdataPrefix().c_str());
putenv(tessdataPrefix.data()); putenv(tessdataPrefix.data());