From 69a0d44d7582823688537fcda9b967da28086da2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 6 Mar 2009 02:10:10 +0000 Subject: [PATCH] make sure the buffer holding the command line is always NUL terminated --- netcat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netcat.c b/netcat.c index dc295fc..277ac32 100644 --- a/netcat.c +++ b/netcat.c @@ -1408,7 +1408,8 @@ main (argc, argv) argv[1] = cp; /* head of new arg block */ fprintf (stderr, "Cmd line: "); 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) bail ("wrong"); x = findline (cp, insaved);