diff options
author | 2015-08-15 19:42:56 +0000 | |
---|---|---|
committer | 2015-08-15 19:42:56 +0000 | |
commit | 467adba8ae1323dae745d4e9ef15ff8933120506 (patch) | |
tree | fde2cb515b4fed9b3df4c5f8f0a044c74b89be11 | |
parent | Use signed variables to store the result of rpc_call(). (diff) | |
download | wireguard-openbsd-467adba8ae1323dae745d4e9ef15ff8933120506.tar.xz wireguard-openbsd-467adba8ae1323dae745d4e9ef15ff8933120506.zip |
When sendrecv() returns -1, have rpc_call() return -1 as well. Otherwise, due
to the cast to unsigned, it fails the error test and returns a bogus partial
read to the caller, which is painful to debug.
-rw-r--r-- | sys/lib/libsa/rpc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/lib/libsa/rpc.c b/sys/lib/libsa/rpc.c index a15a02304ff..4101ff50554 100644 --- a/sys/lib/libsa/rpc.c +++ b/sys/lib/libsa/rpc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc.c,v 1.14 2014/07/13 15:31:20 mpi Exp $ */ +/* $OpenBSD: rpc.c,v 1.15 2015/08/15 19:42:56 miod Exp $ */ /* $NetBSD: rpc.c,v 1.16 1996/10/13 02:29:06 christos Exp $ */ /* @@ -184,7 +184,7 @@ rpc_call(struct iodesc *d, u_int32_t prog, u_int32_t vers, u_int32_t proc, void if (debug) printf("callrpc: cc=%d rlen=%d\n", cc, rlen); #endif - if (cc < -1) + if (cc <= -1) return (-1); if ((size_t)cc <= sizeof(*reply)) { |