1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 07:16:23 -05:00

Fix CID 39902: Insure that buffer is properly terminated after a strncpy.

This commit is contained in:
Renaud 2015-03-17 17:17:35 +08:00
parent 911b4cd402
commit b1cc7bfe3a

View File

@ -198,7 +198,8 @@ static int isearch(int f, int n)
cmd_reexecute = -1; /* We're not re-executing (yet?) */ cmd_reexecute = -1; /* We're not re-executing (yet?) */
cmd_offset = 0; /* Start at the beginning of the buff */ cmd_offset = 0; /* Start at the beginning of the buff */
cmd_buff[0] = '\0'; /* Init the command buffer */ 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 */ curline = curwp->w_dotp; /* Save the current line pointer */
curoff = curwp->w_doto; /* Save the current offset */ curoff = curwp->w_doto; /* Save the current offset */
init_direction = n; /* Save the initial search direction */ init_direction = n; /* Save the initial search direction */