diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-07-25 16:43:00 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-07-25 16:43:00 +0900 |
| commit | 26340a8818e0d54b6fde7a3a1c5f38c9137065bf (patch) | |
| tree | b6ba9a4834e559c980d4e7ad33c6edb6d32336f6 | |
| parent | c2c025006386a164478af4776b158b9d3f4d51df (diff) | |
| download | mruby-26340a8818e0d54b6fde7a3a1c5f38c9137065bf.tar.gz mruby-26340a8818e0d54b6fde7a3a1c5f38c9137065bf.zip | |
time.c: fixed a potential buffer overflow in `time_zonename`.
| -rw-r--r-- | mrbgems/mruby-time/src/time.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c index 3c6959644..99dcb2bcf 100644 --- a/mrbgems/mruby-time/src/time.c +++ b/mrbgems/mruby-time/src/time.c @@ -695,7 +695,7 @@ time_zonename(mrb_state *mrb, struct mrb_time *tm, char *buf, size_t len) datetime.tm_hour = offset / 60; datetime.tm_min = offset % 60; buf[0] = utc_sec < tm->sec ? '-' : '+'; - return strftime(buf+1, len, "%H%M", &datetime) + 1; + return strftime(buf+1, len-1, "%H%M", &datetime) + 1; #else return strftime(buf, len, "%z", &tm->datetime); #endif |
