diff --git a/isearch.c b/isearch.c index 97f4339..d9532fb 100644 --- a/isearch.c +++ b/isearch.c @@ -198,7 +198,8 @@ static int isearch(int f, int n) cmd_reexecute = -1; /* We're not re-executing (yet?) */ cmd_offset = 0; /* Start at the beginning of the buff */ cmd_buff[0] = '\0'; /* Init the command buffer */ - strncpy( pat_save, pat, sizeof pat_save) ; /* Save the old pattern string */ + strncpy( pat_save, pat, sizeof pat_save - 1) ; /* Save the old pattern string */ + pat_save[ sizeof pat_save - 1] = '\0' ; curline = curwp->w_dotp; /* Save the current line pointer */ curoff = curwp->w_doto; /* Save the current offset */ init_direction = n; /* Save the initial search direction */