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
1 changed files with 2 additions and 1 deletions

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':