make sure the buffer holding the command line is always NUL terminated
This commit is contained in:
3
netcat.c
3
netcat.c
@ -1408,7 +1408,8 @@ main (argc, argv)
|
|||||||
argv[1] = cp; /* head of new arg block */
|
argv[1] = cp; /* head of new arg block */
|
||||||
fprintf (stderr, "Cmd line: ");
|
fprintf (stderr, "Cmd line: ");
|
||||||
fflush (stderr); /* I dont care if it's unbuffered or not! */
|
fflush (stderr); /* I dont care if it's unbuffered or not! */
|
||||||
insaved = read (0, cp, BIGSIZ); /* we're gonna fake fgets() here */
|
insaved = read (0, cp, BIGSIZ-1); /* we're gonna fake fgets() here */
|
||||||
|
cp[BIGSIZ-1] = '\0';
|
||||||
if (insaved <= 0)
|
if (insaved <= 0)
|
||||||
bail ("wrong");
|
bail ("wrong");
|
||||||
x = findline (cp, insaved);
|
x = findline (cp, insaved);
|
||||||
|
Reference in New Issue
Block a user