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