aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/touch.c1
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);
}