diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2009-08-31 20:15:04 +1000 |
---|---|---|
committer | maximilian attems <max@stro.at> | 2010-03-22 00:29:17 +0100 |
commit | 9c1cc1118aa69a70b3e14d3c1da4a9d72926f242 (patch) | |
tree | 4234166df0b546970ded99d6fcce9bbfa72bec68 | |
parent | fb696791c622fab6719e724d0d4239225bcbe706 (diff) | |
download | klibc-9c1cc1118aa69a70b3e14d3c1da4a9d72926f242.tar.gz |
[klibc] [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 <herbert@gondor.apana.org.au>
Signed-off-by: maximilian attems <max@stro.at>
-rw-r--r-- | usr/dash/miscbltin.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr/dash/miscbltin.c b/usr/dash/miscbltin.c index 8f0959dc5d46f..ce9a28348ef7c 100644 --- a/usr/dash/miscbltin.c +++ b/usr/dash/miscbltin.c @@ -237,7 +237,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; } |