mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-12 07:29:07 +08:00
Fix CID 1164709 (Copy into fixed size buffer)
Using STRING removes the limitation for the filename length. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
cb77067f55
commit
68450d8680
@ -614,8 +614,6 @@ void Dict::add_document_word(const WERD_CHOICE &best_choice) {
|
|||||||
// the line is recognized.
|
// the line is recognized.
|
||||||
if (hyphen_word_) return;
|
if (hyphen_word_) return;
|
||||||
|
|
||||||
char filename[CHARS_PER_LINE];
|
|
||||||
FILE *doc_word_file;
|
|
||||||
int stringlen = best_choice.length();
|
int stringlen = best_choice.length();
|
||||||
|
|
||||||
if (valid_word(best_choice) || stringlen < 2)
|
if (valid_word(best_choice) || stringlen < 2)
|
||||||
@ -653,9 +651,9 @@ void Dict::add_document_word(const WERD_CHOICE &best_choice) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (save_doc_words) {
|
if (save_doc_words) {
|
||||||
strcpy(filename, getCCUtil()->imagefile.string());
|
STRING filename(getCCUtil()->imagefile);
|
||||||
strcat(filename, ".doc");
|
filename += ".doc";
|
||||||
doc_word_file = open_file (filename, "a");
|
FILE *doc_word_file = open_file (filename.string(), "a");
|
||||||
fprintf(doc_word_file, "%s\n",
|
fprintf(doc_word_file, "%s\n",
|
||||||
best_choice.debug_string().string());
|
best_choice.debug_string().string());
|
||||||
fclose(doc_word_file);
|
fclose(doc_word_file);
|
||||||
|
Loading…
Reference in New Issue
Block a user