aboutsummaryrefslogtreecommitdiffstats
path: root/ext/date/date_parse.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2016-09-30 20:49:58 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-12 20:41:11 +0900
commit3fc10eff1e6dd63bc0daa753108072954adc89ac (patch)
treedea07c416db4a8cb4b5eb6cf8e56ef84caca0109 /ext/date/date_parse.c
parentd96feee37c2d109d0103f08985e85641a23108bf (diff)
downloadruby-3fc10eff1e6dd63bc0daa753108072954adc89ac.tar.gz
date_parse.c: trim off
* ext/date/date_parse.c (date_zone_to_diff): trim off by zone name length.
Diffstat (limited to 'ext/date/date_parse.c')
-rw-r--r--ext/date/date_parse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 8717850eba..519f29cbcb 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -438,13 +438,13 @@ date_zone_to_diff(VALUE str)
}
{
long sl = shrunk_size(s, l);
- if (sl) {
+ if (sl > 0 && sl <= MAX_WORD_LENGTH) {
char *d = ALLOCV_N(char, vbuf, sl);
l = shrink_space(d, s, l);
s = d;
}
}
- {
+ if (l > 0 && l <= MAX_WORD_LENGTH) {
const struct zone *z = zonetab(s, (unsigned int)l);
if (z) {
int d = z->offset;