mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 07:16:09 +00:00
vim-patch:9.0.0733: use of strftime() is not safe (#21228)
Problem: Use of strftime() is not safe.
Solution: Check the return value of strftime(). Use a larger buffer and
correctly pass the available space. (Dominique Pellé, closes
vim/vim#11348)
84d14ccdb5
Co-authored-by: Dominique Pelle <dominique.pelle@gmail.com>
This commit is contained in:
@@ -8445,9 +8445,7 @@ static void f_strftime(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
p = string_convert(&conv, p, NULL);
|
||||
}
|
||||
char result_buf[256];
|
||||
if (p != NULL) {
|
||||
(void)strftime(result_buf, sizeof(result_buf), p, curtime_ptr);
|
||||
} else {
|
||||
if (p == NULL || strftime(result_buf, sizeof(result_buf), p, curtime_ptr) == 0) {
|
||||
result_buf[0] = NUL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user