about summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
authordana <dana@dana.is>2018-12-24 02:42:18 -0600
committerdana <dana@dana.is>2018-12-24 02:42:18 -0600
commitf64cd71d442b0b7152131282dd7567be010edb78 (patch)
treec3471a1d13a548c583018ac26b907252a2ef1881 /Src/Modules
parente75c59f7f5eb2f2d69a0aa346e80a7dc0463dee6 (diff)
downloadzsh-f64cd71d442b0b7152131282dd7567be010edb78.tar.gz
zsh-f64cd71d442b0b7152131282dd7567be010edb78.tar.xz
zsh-f64cd71d442b0b7152131282dd7567be010edb78.zip
43935: Reject too-large nanosecond values given to strftime
... and, in so doing, fix an error in the tests on 32-bit machines.

The value for the new too-large test is changed slightly from the patch posted
to the ML to make it test for the right thing on 32-bit machines as well.
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/datetime.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Src/Modules/datetime.c b/Src/Modules/datetime.c
index 18c7fb58e..521c15a5b 100644
--- a/Src/Modules/datetime.c
+++ b/Src/Modules/datetime.c
@@ -148,7 +148,7 @@ output_strftime(char *nam, char **argv, Options ops, UNUSED(int func))
 	    } else if (*argv[2] == '\0' || *endptr != '\0') {
 		zwarnnam(nam, "%s: invalid decimal number", argv[2]);
 		return 1;
-	    } else if (ts.tv_nsec < 0) {
+	    } else if (ts.tv_nsec < 0 || ts.tv_nsec > 999999999) {
 		zwarnnam(nam, "%s: invalid nanosecond value", argv[2]);
 		return 1;
 	    }