Skip to content

Commit

Permalink
Fix potential buffer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnZhong committed Jan 14, 2023
1 parent 5dc570c commit b723094
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/fmt/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,9 @@ FMT_CONSTEXPR const Char* parse_chrono_format(const Char* begin,
continue;
}
if (begin != ptr) handler.on_text(begin, ptr);
c = *++ptr; // consume '%'
++ptr; // consume '%'
if (ptr == end) FMT_THROW(format_error("invalid format"));
c = *ptr;
switch (c) {
case '_':
pad = pad_type::space;
Expand Down

0 comments on commit b723094

Please sign in to comment.