1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-17 18:16:22 -05:00

Remove buffer overflow by limiting argument size of search pattern.

This commit is contained in:
Renaud 2014-05-28 17:48:47 +08:00
parent 7b398855e7
commit ccbd7d7099

3
main.c
View File

@ -245,7 +245,8 @@ int main(int argc, char **argv)
case 's': /* -s for initial search string */
case 'S':
searchflag = TRUE;
strncpy(pat, &argv[carg][2], NPAT);
strncpy( pat, &argv[ carg][ 2], NPAT - 1) ;
pat[ NPAT -1] = 0 ;
break;
case 'v': /* -v for View File */
case 'V':