]> code.citadel.org Git - citadel.git/blobdiff - citadel/ft_wordbreaker.c
Moved to new module init structure.
[citadel.git] / citadel / ft_wordbreaker.c
index 64d075f22bcf884d633472cd16b0bd1a29ef27c0..6b9fb2d243b54122f4c8a6453ba77c6888b73777 100644 (file)
@@ -37,7 +37,6 @@
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "serv_extensions.h"
 #include "database.h"
 #include "msgbase.h"
 #include "control.h"
@@ -218,7 +217,13 @@ void wordbreaker(char *text, int *num_tokens, int **tokens) {
                        /* extract the word */
                        word_len = word_end - word_start + 1;
                        safestrncpy(word, word_start, sizeof word);
-                       word[word_len] = 0;
+                       if (word_len >= sizeof word) {
+                               lprintf(CTDL_DEBUG, "Invalid word length: %d\n", word_len);
+                               word[(sizeof word_len) - 1] = 0;
+                       }
+                       else {
+                               word[word_len] = 0;
+                       }
                        word_start = NULL;
 
                        /* disqualify noise words */