Skip to content

Commit

Permalink
eval/encode: Adjust buffer sizes passed to vim_snprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
ZyX-I committed Apr 17, 2016
1 parent 3e435df commit c4f1b5a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/nvim/eval/encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ encode_vim_to_##name##_error_ret: \
#define CONV_NUMBER(num) \
do { \
char numbuf[NUMBUFLEN]; \
vim_snprintf(numbuf, NUMBUFLEN - 1, "%" PRId64, (int64_t) (num)); \
vim_snprintf(numbuf, ARRAY_SIZE(numbuf), "%" PRId64, (int64_t) (num)); \
ga_concat(gap, numbuf); \
} while (0)

Expand All @@ -679,7 +679,7 @@ encode_vim_to_##name##_error_ret: \
} \
default: { \
char numbuf[NUMBUFLEN]; \
vim_snprintf(numbuf, NUMBUFLEN - 1, "%g", flt_); \
vim_snprintf(numbuf, ARRAY_SIZE(numbuf), "%g", flt_); \
ga_concat(gap, (char_u *) numbuf); \
} \
} \
Expand Down Expand Up @@ -754,7 +754,7 @@ encode_vim_to_##name##_error_ret: \
} \
} \
} \
vim_snprintf(ebuf, NUMBUFLEN + 6, "{E724@%zu}", backref); \
vim_snprintf(ebuf, ARRAY_SIZE(ebuf), "{E724@%zu}", backref); \
ga_concat(gap, &ebuf[0]); \
return OK; \
} while (0)
Expand Down Expand Up @@ -783,9 +783,9 @@ DEFINE_VIML_CONV_FUNCTIONS(static, string, garray_T *const, gap)
} \
} \
if (conv_type == kMPConvDict) { \
vim_snprintf(ebuf, NUMBUFLEN + 6, "{...@%zu}", backref); \
vim_snprintf(ebuf, ARRAY_SIZE(ebuf), "{...@%zu}", backref); \
} else { \
vim_snprintf(ebuf, NUMBUFLEN + 6, "[...@%zu]", backref); \
vim_snprintf(ebuf, ARRAY_SIZE(ebuf), "[...@%zu]", backref); \
} \
ga_concat(gap, &ebuf[0]); \
return OK; \
Expand Down Expand Up @@ -821,7 +821,7 @@ DEFINE_VIML_CONV_FUNCTIONS(, echo, garray_T *const, gap)
#define CONV_UNSIGNED_NUMBER(num) \
do { \
char numbuf[NUMBUFLEN]; \
vim_snprintf(numbuf, sizeof(numbuf), "%" PRIu64, (num)); \
vim_snprintf(numbuf, ARRAY_SIZE(numbuf), "%" PRIu64, (num)); \
ga_concat(gap, numbuf); \
} while (0)

Expand All @@ -840,7 +840,7 @@ DEFINE_VIML_CONV_FUNCTIONS(, echo, garray_T *const, gap)
} \
default: { \
char numbuf[NUMBUFLEN]; \
vim_snprintf(numbuf, NUMBUFLEN - 1, "%g", flt_); \
vim_snprintf(numbuf, ARRAY_SIZE(numbuf), "%g", flt_); \
ga_concat(gap, (char_u *) numbuf); \
break; \
} \
Expand Down

0 comments on commit c4f1b5a

Please sign in to comment.