summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorNatanael Copa2016-05-19 17:31:59 +0200
committerDenys Vlasenko2016-05-31 02:50:54 +0200
commitb684d1b1864ba9d7968de5565823f8e42f1dc448 (patch)
treef2e72a858793948363809edd10791bc00e278d96 /libbb
parent8e95068c7f28fe2a1e31b01636e3ed29eed09ef8 (diff)
downloadbusybox-b684d1b1864ba9d7968de5565823f8e42f1dc448.zip
busybox-b684d1b1864ba9d7968de5565823f8e42f1dc448.tar.gz
libbb: fix time parsing of [[CC]YY]MMDDhhmm[.SS]. Closes 8951
If SS is not given a value, it is assumed to be zero. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/time.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libbb/time.c b/libbb/time.c
index aa19a47..82e6cb1 100644
--- a/libbb/time.c
+++ b/libbb/time.c
@@ -186,6 +186,7 @@ void FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
} else {
bb_error_msg_and_die(bb_msg_invalid_date, date_str);
}
+ ptm->tm_sec = 0; /* assume zero if [.SS] is not given */
if (end == '.') {
/* xxx.SS */
if (sscanf(strchr(date_str, '.') + 1, "%u%c",