From cdb7c72699056856ac123d1ba4ab0e8595edbeb9 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Mon, 31 Aug 2009 20:15:04 +1000 Subject: [BUILTIN] Fix NUL termination in readcmd Commit 55c46b7286f5d9f2d8291158203e2b61d2494420 ([BUILTIN] Honor tab as IFS whitespace when splitting fields in readcmd) introduced a bug where sometimes garbage would follow the last field preceding the end-of-line. This was caused by an off-by-one error in the string length calculation. This patch fixes the bug. Signed-off-by: Herbert Xu --- src/miscbltin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/miscbltin.c b/src/miscbltin.c index cca0f6c..be746b2 100644 --- a/src/miscbltin.c +++ b/src/miscbltin.c @@ -182,7 +182,7 @@ resetbs: backslash = 0; } STACKSTRNUL(p); - readcmd_handle_line(stackblock(), ap, p - (char *)stackblock()); + readcmd_handle_line(stackblock(), ap, p + 1 - (char *)stackblock()); return status; } -- cgit 1.4.1