From 68450d8680a0ce69b943ce44b75e4a78223a5c64 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 23 Apr 2018 08:57:09 +0200 Subject: [PATCH] Fix CID 1164709 (Copy into fixed size buffer) Using STRING removes the limitation for the filename length. Signed-off-by: Stefan Weil --- dict/dict.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dict/dict.cpp b/dict/dict.cpp index 1ad99fc1..3804b7db 100644 --- a/dict/dict.cpp +++ b/dict/dict.cpp @@ -614,8 +614,6 @@ void Dict::add_document_word(const WERD_CHOICE &best_choice) { // the line is recognized. if (hyphen_word_) return; - char filename[CHARS_PER_LINE]; - FILE *doc_word_file; int stringlen = best_choice.length(); 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) { - strcpy(filename, getCCUtil()->imagefile.string()); - strcat(filename, ".doc"); - doc_word_file = open_file (filename, "a"); + STRING filename(getCCUtil()->imagefile); + filename += ".doc"; + FILE *doc_word_file = open_file (filename.string(), "a"); fprintf(doc_word_file, "%s\n", best_choice.debug_string().string()); fclose(doc_word_file);