Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Oct 1997 10:47:33 -0800 (PST)
From:      Bill Paul <wpaul@FreeBSD.ORG>
To:        cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG, cvs-lib@FreeBSD.ORG
Subject:   cvs commit: src/lib/libc/rpc clnt_udp.c
Message-ID:  <199710261847.KAA00421@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
wpaul       1997/10/26 10:47:32 PST

  Modified files:
    lib/libc/rpc         clnt_udp.c 
  Log:
  In clntudp_call(), it is possible that xdr_replymsg() might fail
  partway through its attempt to decode the result structure sent by
  the server. If this happens, it can leave the result partially
  populated with dynamically allocated memory. In this event, the
  xdr_replymsg() failure is detected and RPC_CANTDECODERES is returned,
  but the memory in the partially populated result struct is not
  free()d.
  
  The end result is that memory is leaked when an RPC_CANTDECODERES
  error occurs. (This condition can occur if a CLIENT * handle is created
  using clntudp_bufcreate() with a receive buffer size that is too small
  to handle the result sent by the server.)
  
  Fixed by setting reply_xdrs.x_op to XDR_FREE and calling
  xdr_replymsg() again to free the memory if an RPC_CANTDECODERES error
  is detected.
  
  I suspect that the clnt_tcp.c, clnt_unix.c and clnt_raw.c modules
  may ha a similar problem, but I haven't duplicated the condition with
  those yet.
  
  Found by: dbmalloc
  
  Revision  Changes    Path
  1.12      +14 -0     src/lib/libc/rpc/clnt_udp.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710261847.KAA00421>