diff options
author | Rob Landley <rob@landley.net> | 2013-09-09 06:50:00 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2013-09-09 06:50:00 -0500 |
commit | f93d4862a92b58be01de879b18705fb1d3349bde (patch) | |
tree | 993cfb00539c132ee4fe2677943226fd72dbb183 /toys/posix/touch.c | |
parent | 94fdf492936c6ebe6074d8bf5f471823b0c6b94c (diff) | |
download | toybox-f93d4862a92b58be01de879b18705fb1d3349bde.tar.gz |
Don't write a zero past end of toybuf with large -d value.
Diffstat (limited to 'toys/posix/touch.c')
-rw-r--r-- | toys/posix/touch.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/toys/posix/touch.c b/toys/posix/touch.c index 3a65e931..4d46a162 100644 --- a/toys/posix/touch.c +++ b/toys/posix/touch.c @@ -72,6 +72,7 @@ void touch_main(void) putenv("TZ=UTC"); strncpy(toybuf, date, sizeof(toybuf)-1); date = toybuf; + if (i > sizeof(toybuf)-1) i = sizeof(toybuf)-1; date[i]=0; gmtime_r(&(tv->tv_sec), &tm); } |