mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
vim-patch:8.2.4473: Coverity warns for not checking return value of ftell() (#17914)
Problem: Coverity warns for not checking return value of ftell().
Solution: Bail out if ftell() returns a negative value.
416b5f4894
This commit is contained in:
@@ -5580,6 +5580,9 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
|
|||||||
while (!vim_fgets(line, MAXWLEN * 2, fd)) {
|
while (!vim_fgets(line, MAXWLEN * 2, fd)) {
|
||||||
fpos = fpos_next;
|
fpos = fpos_next;
|
||||||
fpos_next = ftell(fd);
|
fpos_next = ftell(fd);
|
||||||
|
if (fpos_next < 0) {
|
||||||
|
break; // should never happen
|
||||||
|
}
|
||||||
if (STRNCMP(word, line, len) == 0
|
if (STRNCMP(word, line, len) == 0
|
||||||
&& (line[len] == '/' || line[len] < ' ')) {
|
&& (line[len] == '/' || line[len] < ' ')) {
|
||||||
// Found duplicate word. Remove it by writing a '#' at
|
// Found duplicate word. Remove it by writing a '#' at
|
||||||
|
Reference in New Issue
Block a user