summaryrefslogtreecommitdiffstats
path: root/sys/contrib/libnv
Commit message (Collapse)AuthorAgeFilesLines
* MFC r302966:oshogbo2016-08-081-2/+4
| | | | | | | | | | | Fix nvlist array memory leak. When we change nvl_array_next to NULL it means that we want to destroy or take nvlist_array. The nvpair, which stores next nvlist of nvlist_array element is no longer needed and can be freed. Submitted by: Adam Starak <starak.adam@gmail.com> Approved by: re (gjb)
* MFC r302965:oshogbo2016-08-081-0/+1
| | | | | | | Fix memory leak in the nvlist string array. Submitted by: Adam Starak <starak.adam@gmail.com> Approved by: re (gjb)
* Add support for the arrays in nvlist library.oshogbo2015-08-155-83/+1591
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add nvlist_{add,get,take,move,exists,free}_{number,bool,string,nvlist, descriptor} functions. - Add support for (un)packing arrays. - Add the nvl_array_next field to the nvlist structure. If an array is added by the nvlist_{move,add}_nvlist_array function this field will contains next element in the array. - Add the nitems field to the nvpair and nvpair_header structure. This field contains number of elements in the array. - Add special flag (NV_FLAG_IN_ARRAY) which is set if nvlist is a part of an array. - Add special type (NV_TYPE_NVLIST_ARRAY_NEXT).This type is used only on packing/unpacking. - Add new API for traversing arrays (nvlist_get_array_next). - Add the nvlist_get_pararr function which combines the nvlist_get_array_next and nvlist_get_parent functions. If nvlist is in the array it will return next element from array. If nvlist is last element in array or it isn't in array it will return his container (parent). This function should simplify traveling over nvlist. - Add tests for new features. - Add documentation for new functions. - Add my copyright. - Regenerate the sys/cddl/compat/opensolaris/sys/nvpair.h file. PR: 191083 Reviewed by: allanjude (doc) Approved by: pjd (mentor)
* If any function fail (the ptr variable will be equal to NULL), we shouldn'toshogbo2015-08-111-10/+9
| | | | | | return buffer. Instead we should free it and return NULL. Approved by: pjd (mentor)
* The nvlist_move_nvpair() function can fail in two cases, if:oshogbo2015-08-112-14/+16
| | | | | | | | | | | | | | | | | - the nvlist error is set, or - the nvlist case ignore flag is not set and there is attend to add element with duplicated name. In both cases the nvlist_move_nvpair() function free nvpair structure. If library will try to unpack a binary blob which contains duplicated names it will end up with using memory after free. To prevent that, the nvlist_move_nvpair() function interface is changed to report about failure and checks are added to the nvpair_xunpack() function. Discovered thanks to the american fuzzy lop. Approved by: pjd (mentor)
* Don't set parent if the unpack operation fail. In someoshogbo2015-08-111-0/+2
| | | | | | | | case this could crash the library, because of the NULL pointer references. Discovered thanks to american fuzzy lop. Approved by: pjd (mentor)
* Make the nvlist_next(9) function handle NULL pointer variable.oshogbo2015-08-111-3/+3
| | | | | | | This simplifies removing the first element from nvlist. Reviewed by: AllanJude Approved by: pjd (mentor)
* Move the nvlist source and private includes from sys/kern to seperateoshogbo2015-07-046-0/+2955
directory sys/contrib/libnv. The goal of this operation is to NOT install header files which shouldn't be used outside the nvlist library. Approved by: pjd (mentor)
OpenPOWER on IntegriCloud