wg: error on short ret reads
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
16060516bb
commit
e92e0dca14
1 changed files with 4 additions and 0 deletions
|
@ -179,6 +179,10 @@ static int userspace_set_device(struct wgdevice *dev)
|
|||
ret = read(fd, &ret_code, sizeof(ret_code));
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
if (ret != sizeof(ret_code)) {
|
||||
ret = -EBADMSG;
|
||||
goto out;
|
||||
}
|
||||
ret = ret_code;
|
||||
out:
|
||||
close(fd);
|
||||
|
|
Loading…
Reference in a new issue