summaryrefslogtreecommitdiff
path: root/ext/date/date_parse.c
diff options
context:
space:
mode:
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;