mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 20:18:32 +00:00
coverity/13777: String not null terminated: RI.
Problem : String not null terminated @ 1543. Diagnostic : Real issue. Rationale : We are reading a struct block0, which contains some string fields, from a file, without checking for string fields to be correctly terminated. That could cause a buffer overrun if file has somehow been garbled. Resolution : Add string fields check for nul termination. Mark issue as intentional (there seems to be no way of teaching coverity about read_eintr being ok that way). Helped-by: oni-link <knil.ino@gmail.com>
This commit is contained in:
@@ -7416,7 +7416,7 @@ long read_eintr(int fd, void *buf, size_t bufsize)
|
||||
long ret;
|
||||
|
||||
for (;; ) {
|
||||
ret = vim_read(fd, buf, bufsize);
|
||||
ret = read(fd, buf, bufsize);
|
||||
if (ret >= 0 || errno != EINTR)
|
||||
break;
|
||||
}
|
||||
@@ -7435,7 +7435,7 @@ long write_eintr(int fd, void *buf, size_t bufsize)
|
||||
/* Repeat the write() so long it didn't fail, other than being interrupted
|
||||
* by a signal. */
|
||||
while (ret < (long)bufsize) {
|
||||
wlen = vim_write(fd, (char *)buf + ret, bufsize - ret);
|
||||
wlen = write(fd, (char *)buf + ret, bufsize - ret);
|
||||
if (wlen < 0) {
|
||||
if (errno != EINTR)
|
||||
break;
|
||||
|
Reference in New Issue
Block a user