summaryrefslogtreecommitdiffstats
path: root/lib/libc/rpc
Commit message (Collapse)AuthorAgeFilesLines
* MFS r320581: MFC r320494: Fix double free by reverting r300385 anddelphij2017-07-031-3/+1
| | | | | | r300624 which was false positive reported by cppcheck. Approved by: re (kib)
* MFC r320216: Fix use-after-free introduced in r300388.delphij2017-06-251-1/+2
| | | | | | | | | | | | In r300388, endnetconfig() was called on nc_handle which would release the associated netconfig structure, which means tmpnconf->nc_netid would be a use-after-free. Solve this by doing endnetconfig() in return paths instead. Reported by: jemalloc via kevlo Reviewed by: cem, ngie (earlier version) Approved by: re (kib)
* MFC r319369:delphij2017-06-063-12/+22
| | | | | | | | | | | | | | | * limit size of buffers to RPC_MAXDATASIZE * don't leak memory * be more picky about bad parameters From: https://raw.githubusercontent.com/guidovranken/rpcbomb/master/libtirpc_patch.txt https://github.com/guidovranken/rpcbomb/blob/master/rpcbind_patch.txt via NetBSD. Approved by: re (kib)
* MFC r317660, r317710brooks2017-05-151-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | r317660: Support clnt_raw's use of FD_SETSIZE as a fake file descriptor. Accomplish this by allocating space for it in __svc_xports and allowing it to be registered. The failure to allocate space was causing an out-of-bounds read in svc_getreq_common(). The failure to register caused PR 211804. The bug was found with CHERI bounds checking. PR: 211804 Obtained from: CheriBSD Sponsored by: DARPA, AFRL Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D10528 r317710: Remove expected failure now that it was fixed in r317660. PR: 211804 Reviewed by: ngie Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10576
* MFC r315162:pfg2017-04-071-2/+2
| | | | | | | | libc: provide some bounds-checking through reallocarray(3). reallocarray(3) is a non portable extension that originated in OpenBSD. Given that it is already in FreeBSD's libc it is useful for the cases where reallocation involves a multiplication.
* MFC r303889:pfg2016-09-081-1/+1
| | | | | | | | libc/rpc: replace comma with semicolon when pertinent. Uses of commas instead of a semicolons can easily go undetected. The comma can serve as a statement separator but this shouldn't be abused when statements are meant to be standalone.
* Use on crypto.x and rpc.x from the source tree.bdrewery2016-06-281-1/+1
| | | | | | | | | This fixes the build when DESTDIR may be blank or not yet populated. It also fixes reproducibility. Submitted by: brooks Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D6455
* libc/rpc: Make use of some xdr_* macros. (part 2)pfg2016-06-093-19/+19
| | | | | | xdr_rpcproc, xdr_rpcprog and xdr_rpcvers were broken in older versions of FreeBSD but fixed in r296394. Give them some use hoping they help make the code somewhat more readable.
* libc/rpc: Make use of some xdr_* macros.pfg2016-06-092-7/+7
| | | | | | xdr_rpcprog and xdr_rpcvers were broken in older versions of FreeBSD but were fixed in r296394. Give them some use hoping they help make the code somewhat more readable.
* Fix the rpcb_getaddr() definition to match its declaration.kevlo2016-06-091-1/+1
| | | | Submitted by: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
* Test for strchr(3) returning NULL, not 0ngie2016-06-081-1/+1
| | | | | | MFC after: 3 days Reported by: coccinelle Sponsored by: EMC / Isilon Storage Division
* Fix up r300385ngie2016-05-241-2/+3
| | | | | | | | | | | | | | I accidentally glossed over the fact that tmp is manipulated via strchr, so if we tried to free `tmp` after r300385, it would have crashed. Create a separate pointer (tmp2) to track the original allocation of `tmp`, and free `tmp2` if `p->nc_lookups` can't be malloced MFC after: 4 days X-MFC with: r300385 Reported by: Coverity CID: 1356026 Sponsored by: EMC / Isilon Storage Division
* Remove redundant NULLing of outbuf_pmapngie2016-05-241-1/+0
| | | | | | | | | If reallocf ever failed, outbuf_pmap would already be NULL MFC after: 1 week X-MFC with: r300620 Reported by: cem Sponsored by: EMC / Isilon Storage Division
* Use reallocf instead of malloc to fix leak with outbuf_pmapngie2016-05-241-1/+3
| | | | | | | | | | | | | | | | The previous code overwrote outbuf_pmap's memory with malloc once per loop iteration, which leaked its memory; use reallocf instead to ensure that memory is properly free'd each loop iteration. Add a outbuf_pmap = NULL in the failure case to avoid a double-free at the bottom of the function. Differential Revision: https://reviews.freebsd.org/D6495 MFC after: 1 week Reported by: Coverity CID: 1038776 Reviewed by: markj, pfgj Sponsored by: EMC / Isilon Storage Division
* nis_rpcent: don't leak resultbuf from yp_first(..)/yp_next(..)ngie2016-05-221-0/+2
| | | | | | | | | | If the buffer couldn't be adequately resized to accomodate an additional "\n", it would leak resultbuf by breaking from the loop early MFC after: 2 weeks Reported by: Coverity CID: 1016702 Sponsored by: EMC / Isilon Storage Division
* Call endnetconfig on nc_handle sooner to avoid leaking nc_handle if tmpnconfngie2016-05-221-1/+1
| | | | | | | | | | | | was NULL This would theoretically happen if the netconfig protocol family and protocol semantics were never matched. MFC after: 2 weeks Reported by: Coverity CID: 978179 Sponsored by: EMC / Isilon Storage Division
* getnetid(..): consistently fclose fd at the end of the functionngie2016-05-221-11/+15
| | | | | | | | This mutes a false positive with cppcheck, but also helps eliminate future potential issues with this variable MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division
* Don't leak `handle` if svc_tp_create(..) succeeds and allocating a newngie2016-05-221-1/+3
| | | | | | | | | struct xlist object fails MFC after: 1 week Reported by: Coverity CID: 978277 Sponsored by: EMC / Isilon Storage Division
* Don't leak `tmp` if `p->nc_lookups` can't be mallocedngie2016-05-221-0/+1
| | | | | | MFC after: 1 week Reported by: cppcheck Sponsored by: EMC / Isilon Storage Division
* libc: spelling fixes.pfg2016-04-307-11/+11
| | | | Mostly on comments.
* libc: do not include <sys/types.h> where <sys/param.h> was already includedavos2016-04-183-3/+0
| | | | | | According to style(9): > normally, include <sys/types.h> OR <sys/param.h>, but not both. (<sys/param.h> already includes <sys/types.h> when LOCORE is not defined).
* libc: cleanup unnecessary semicolons (part 2).pfg2016-04-112-2/+2
| | | | Found with devel/coccinelle.
* libc: replace 0 with NULL for pointers.pfg2016-04-104-13/+13
| | | | | | | | | While here also cleanup some surrounding code; particularly drop some malloc() casts. Found with devel/coccinelle. Reviewed by: bde (previous version - all new bugs are mine)
* Stray tabs and spaces.pfg2016-03-051-8/+8
| | | | No functional change.
* Work around aliasing issues detected in modern GCC.pfg2016-03-041-16/+20
| | | | | | | Avoid casting gymnastics that lead to pointer aliasing by introducing an inline function as done in NetBSD (but without #if0'd WIP code). Obtained from: NetBSD (CVS Rev. 1.24, 1.25)
* RPC: update the getrpcbyname() definition to include a const qualifier.pfg2016-02-262-3/+3
| | | | | | | Add const qualifier making getrpcbyname() and getrpcbyname_r() prototypes match those used in latest Sun RPC code (TI-RPC 2.3). Obtained from: NetBSD
* rpc: fix failure to clear string by passing the wrong size to memset.pfg2016-02-261-1/+1
| | | | | | | Noted by NetBSD's PR/21014 Obtained from: NetBSD (CVS Rev. 1.24, 1.25) MFC after: 1 month
* Fix a mismerge from NetBSD in r162194 with `xdr_rpcb_entry_list_ptr(..)`ngie2016-01-121-2/+2
| | | | | | | | | | | This fixes the potential NULL pointer dereference properly, and also fixes memory leaks encountered in the process of iterating through `*rp`. MFC after: 1 week Found by: Valgrind Reported by: Dan Roberts <dan.roberts@isilon.com> Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com> Sponsored by: EMC / Isilon Storage Division
* Similar to r293704, fix theoretical leak of netconfig(3) resources inngie2016-01-111-2/+2
| | | | | | | | | | | __rpcbind_is_up(..) if getnetconfig(3) is partly successful in allocating resources, but not completely successful by moving the endnetconfig(3) call up before we return from the function if nconf == NULL. MFC after: 1 week Reported by: Coverity Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com> Sponsored by: EMC / Isilon Storage Division
* Fix theoretical leak of netconfig(3) resources in svcunix_create(..)ngie2016-01-111-1/+1
| | | | | | | | | | | | | In the event that the getconfig(3) call in svcunix_create is partly successful, some of the netconfig(3) resources allocated might be leaked if the call returns NULL as endnetconfig(3) wasn't called explicitly in that case. Ensure that the resources are fully cleaned up by going to the `done` label, which will call endnetconfig(3) for us. MFC after: 1 week Reported by: Coverity Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com> Sponsored by: EMC / Isilon Storage Division
* RPC: populate local address for rendezvous transporter.stas2015-12-101-2/+16
| | | | | | | | | | | When accepting a connection on underlying tcp socket rpc vc transporter fails to populate local address. This change rectifies this problem by modifying rendezvous_request() to fill out the xptr structure member with appropriate information. Submitted by: Alex Burlyga <alex.burlyga.ietf@gmail.com> MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D4206
* Remove unnecessary `if (x)` tests before calling `free(x)`; free(3)ngie2015-11-0210-49/+25
| | | | | | | already employs this check MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division
* Use proper function prototypes.rodrigc2015-10-072-4/+4
| | | | Eliminates -Wstrict-prototypes warning
* Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.rodrigc2015-09-2235-409/+235
|
* Use ANSI C prototypes.rodrigc2015-09-201-69/+31
| | | | Eliminates gcc 4.9 warnings.
* Use unsigned variable.rodrigc2015-09-011-1/+1
| | | | Eliminates gcc 4.9 compiler warning.
* Use ANSI C prototypes.rodrigc2015-09-015-12/+12
| | | | Eliminates gcc 4.9 warnings.
* Use correct function prototype for signal handler.rodrigc2015-09-011-2/+2
| | | | Eliminates gcc 4.9 warning.
* Use ANSI C prototypes.rodrigc2015-09-011-21/+7
| | | | Eliminates gcc 4.9 warnings.
* Mark unused parameters to reduce gcc 4.9 warnings.rodrigc2015-09-011-2/+2
|
* Use ANSI C prototypes.rodrigc2015-09-0115-395/+180
| | | | Eliminates gcc 4.9 warnings.
* mdoc: fix functions declarationsbapt2015-04-261-1/+1
|
* libc: clean some set-but-not-used errors.pfg2015-02-182-4/+1
| | | | | | | These were found by gcc 5.0 on Dragonfly BSD, however I made no attempt to silence the false positives. Obtained from: DragonFly (cf515c3a6f3a8964ad592e524442bc628f8ed63b)
* rpc: Uninitialized pointer readpfg2015-02-021-1/+1
| | | | | | | | | Initialize *xprt to avoid exposing a random value in cleanup_svc_vc_create. CID: 1018723 Phabric: D1749 Reviewed by: alfred
* Resource leakpfg2015-02-011-0/+1
| | | | | CID: 1016703 Reviewed by: alfred
* mdoc: improvements to SEE ALSO.joel2014-12-272-2/+2
|
* Remove an unused variable that would be better spelled __func__.brooks2014-10-241-1/+0
| | | | Sponsored by: DARPA, AFRL
* Properly free resources in case of error.brueffer2014-05-021-8/+6
| | | | | | CID: 1007032 Found with: Coverity Prevent(tm) MFC after: 2 weeks
* Move definitions out of rpc_com so that the linker doesn't complain abouttheraven2014-04-062-2/+5
| | | | | | multiple definitions. Reported by: sbruno
* Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP}marcel2014-03-041-3/+3
| | | | | | | | | | | if not already defined. This allows building libc from outside of lib/libc using a reach-over makefile. A typical use-case is to build a standard ILP32 version and a COMPAT32 version in a single iteration by building the COMPAT32 version using a reach-over makefile. Obtained from: Juniper Networks, Inc.
OpenPOWER on IntegriCloud