Skip to content

Commit 68450d8

Browse files
committed
Fix CID 1164709 (Copy into fixed size buffer)
Using STRING removes the limitation for the filename length. Signed-off-by: Stefan Weil <[email protected]>
1 parent cb77067 commit 68450d8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

dict/dict.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,6 @@ void Dict::add_document_word(const WERD_CHOICE &best_choice) {
614614
// the line is recognized.
615615
if (hyphen_word_) return;
616616

617-
char filename[CHARS_PER_LINE];
618-
FILE *doc_word_file;
619617
int stringlen = best_choice.length();
620618

621619
if (valid_word(best_choice) || stringlen < 2)
@@ -653,9 +651,9 @@ void Dict::add_document_word(const WERD_CHOICE &best_choice) {
653651
}
654652

655653
if (save_doc_words) {
656-
strcpy(filename, getCCUtil()->imagefile.string());
657-
strcat(filename, ".doc");
658-
doc_word_file = open_file (filename, "a");
654+
STRING filename(getCCUtil()->imagefile);
655+
filename += ".doc";
656+
FILE *doc_word_file = open_file (filename.string(), "a");
659657
fprintf(doc_word_file, "%s\n",
660658
best_choice.debug_string().string());
661659
fclose(doc_word_file);

0 commit comments

Comments
 (0)