libtirpc/libtirpc-0.1.7-taddr2uaddr-segflt.patch
2008-10-27 17:17:04 +00:00

26 lines
727 B
Diff

commit 338af7f9f00e096b65a6d823f885c4eeaf1d1f8c
Author: Steve Dickson <steved@redhat.com>
Date: Mon Oct 27 12:46:54 2008 -0400
__rpc_taddr2uaddr_af() assumes the netbuf to always have a
non-zero data. This is a bad assumption and can lead to a
seg-fault. This patch adds a check for zero length and returns
NULL when found.
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/src/rpc_generic.c b/src/rpc_generic.c
index 3aad018..27de254 100644
--- a/src/rpc_generic.c
+++ b/src/rpc_generic.c
@@ -603,6 +603,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
#endif
u_int16_t port;
+ if (nbuf->len <= 0)
+ return NULL;
+
switch (af) {
case AF_INET:
sin = nbuf->buf;