mirror of
https://github.com/tmux/tmux.git
synced 2026-04-16 03:56:28 +00:00
Limit precision to 100 to stop silly formats from running out of memory,
reported by z1281552865 at gmail dot com.
This commit is contained in:
6
format.c
6
format.c
@@ -90,6 +90,9 @@ format_job_cmp(struct format_job *fj1, struct format_job *fj2)
|
||||
/* Maimum repeat size. */
|
||||
#define FORMAT_MAX_REPEAT 10000
|
||||
|
||||
/* Maimum precision. */
|
||||
#define FORMAT_MAX_PRECISION 100
|
||||
|
||||
/* Format modifiers. */
|
||||
#define FORMAT_TIMESTRING 0x1
|
||||
#define FORMAT_BASENAME 0x2
|
||||
@@ -4850,7 +4853,8 @@ format_replace_expression(struct format_modifier *mexp,
|
||||
|
||||
/* The third argument may be precision. */
|
||||
if (argc >= 3) {
|
||||
prec = strtonum(mexp->argv[2], INT_MIN + 1, INT_MAX, &errstr);
|
||||
prec = strtonum(mexp->argv[2], -FORMAT_MAX_PRECISION,
|
||||
FORMAT_MAX_PRECISION, &errstr);
|
||||
if (errstr != NULL) {
|
||||
format_log(es, "expression precision %s: %s", errstr,
|
||||
mexp->argv[2]);
|
||||
|
||||
Reference in New Issue
Block a user