From ae29514eeef2bf89f767ca70b1195b06cc63c5da Mon Sep 17 00:00:00 2001 From: Reece Dunn Date: Thu, 12 May 2011 20:07:23 +0100 Subject: [PATCH] fix out-of-bounds copy --- src/dictionary.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dictionary.cpp b/src/dictionary.cpp index 6d7cb779..5f024b0f 100644 --- a/src/dictionary.cpp +++ b/src/dictionary.cpp @@ -2920,7 +2920,7 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor const char *word_end; const char *word1; int wflags = 0; - char word_buf[N_WORD_BYTES]; + char word_buf[N_WORD_BYTES + 1] = {0}; if(wtab != NULL) { @@ -2930,7 +2930,7 @@ static const char *LookupDict2(Translator *tr, const char *word, const char *wor word1 = word; if(tr->transpose_min > 0) { - strcpy(word_buf,word); + strncpy(word_buf,word, N_WORD_BYTES); wlen = TransposeAlphabet(tr, word_buf); word = word_buf; }