diff --git a/src/search.c b/src/search.c
index 185e9aa0efd4b8ab4a3de232bd69596096b1c4c9..d7be008011fdb03d03590e68f719aba614f4ff92 100644
--- a/src/search.c
+++ b/src/search.c
@@ -315,7 +315,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
 	    /* If we're searching for whole words, see if this potential
 	     * match is a whole word. */
 	    if (wholeword) {
-		char *word = mallocstrncpy(word, found, found_len + 1);
+		char *word = mallocstrncpy(NULL, found, found_len + 1);
 		word[found_len] = '\0';
 
 		found_whole = is_whole_word(found - fileptr->data,