summaryrefslogtreecommitdiff
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* MFC r293856:Brooks Davis2016-01-221-1/+1
| | | | | | | | | | | | | | | Avoid reading pass the end of the source buffer when it is not NUL terminated. If this buffer is adjacent to an unmapped page or a version of C with bounds checked is used this may result in a crash. PR: 206178 Submitted by: Alexander Cherepanov <cherepan@mccme.ru> Requested by: danfe Notes: svn path=/stable/8/; revision=294538
* MFC r293855:Brooks Davis2016-01-221-1/+1
| | | | | | | | | | | | | | | Avoid reading pass the end of the source buffer when it is not NUL terminated. If this buffer is adjacent to an unmapped page or a version of C with bounds checked is used this may result in a crash. PR: 206177 Submitted by: Alexander Cherepanov <cherepan@mccme.ru> Requested by: danfe Notes: svn path=/stable/8/; revision=294537
* MFC r284229: Add support for '_' occurring at the beginning orHajimu UMEMOTO2015-06-181-3/+3
| | | | | | | | | | end of a name component. PR: 176093 Submitted by: landonf__at__bikemonkey.org Notes: svn path=/stable/8/; revision=284561
* MFC 281887:John Baldwin2015-06-023-3/+3
| | | | | | | | Reassign copyright statements on several files from Advanced Computing Technologies LLC to Hudson River Trading LLC. Notes: svn path=/stable/8/; revision=283927
* MFC 282417:John Baldwin2015-06-021-7/+19
| | | | | | | | | | | | | | | | | | | Various updates to the ftruncate(2) documentation: - Note that ftruncate(2) can operate on shared memory objects and cross reference shm_open(2). - Note that ftruncate(2) does not change the file position pointer (aka seek pointer) of the file descriptor. - ftruncate(2) will fail with EINVAL for all sorts of other fd types than just sockets, so instead note that it fails for all but regular files and shared memory objects. - Note that ftruncate(2) also appeared in 4.2BSD along with truncate(2). (Or at least the manpage for both appeared in 4.2, I did not check the kernel code itself to see if either predated 4.2.) PR: 199472 Notes: svn path=/stable/8/; revision=283916
* MFC 281170:John Baldwin2015-06-021-2/+2
| | | | | | | | | | vfork() first appeared in 3BSD which pre-dates 2.9BSD. Verified via the copy of 3BSD on disc 1 of "The CSRG Archives". PR: 198612 Notes: svn path=/stable/8/; revision=283912
* MFC r278530:Bryan Drewery2015-04-031-0/+1
| | | | | | | | | | | When catopen(3) returns an error, it caches the result of that error from r202992. The refcount on the cache entry is not initialized, so any attempt to clean the cache will skip over this item since it likely has a >0 value. This change is currently a NOP. Notes: svn path=/stable/8/; revision=281035
* MFC r272291:Bryan Drewery2015-04-031-1/+3
| | | | | | | Document [EPERM] for UNIX sockets. Notes: svn path=/stable/8/; revision=281032
* MFC r278739:Xin LI2015-02-171-0/+17
| | | | | | | | | | | Disallow pattern spaces which would cause intermediate calculations to overflow size_t. Obtained from: DragonFly (2841837793bd095a82f477e9c370cfe6cfb3862c dillon) Security: CERT VU#695940 Notes: svn path=/stable/8/; revision=278912
* MFC r275930:Xin LI2015-01-021-1/+3
| | | | | | | | | Plug a memory leak. Obtained from: DragonFlyBSD (commit 5119ece) Notes: svn path=/stable/8/; revision=276555
* Fix cut/paste brain-o. Spell #endif correctly.Peter Wemm2014-08-071-1/+1
| | | | Notes: svn path=/stable/8/; revision=269684
* Like on stable/9 and later, don't redefine MALLOC_PRODUCTIONPeter Wemm2014-08-071-0/+2
| | | | Notes: svn path=/stable/8/; revision=269683
* MFC r227519, r227520:Xin LI2014-06-121-71/+62
| | | | | | | | | | | | | | | | | | | | | | r227519 (das) Sync the style, comments, and variable names of arc4random.c with OpenBSD's version (r1.22). No functional changes, as verified with md5. r227520 (das) Further reduce diffs with OpenBSD's arc4random. The main functional change here is to ensure that when a process forks after arc4random is seeded, the parent and child don't observe the same random sequence. OpenBSD's fix introduces some additional overhead in the form of a getpid() call. The only significant remaining difference between our arc4random and OpenBSD's is in how we seed the generator in arc4_stir(). Notes: svn path=/stable/8/; revision=267380
* MFC r265534:Peter Holm2014-05-231-5/+7
| | | | | | | | | | | msync(2) must return ENOMEM and not EINVAL when the address is outside the allowed range or when one or more pages are not mapped. This according to The Open Group Base Specifications Issue 7. Sponsored by: EMC / Isilon storage division Notes: svn path=/stable/8/; revision=266574
* MFC: r265238Christian Brueffer2014-05-161-8/+6
| | | | | | | | | | Properly free resources in case of error. CID: 1007032 Found with: Coverity Prevent(tm) Notes: svn path=/stable/8/; revision=266250
* MFC: r262296Christian Brueffer2014-02-281-3/+3
| | | | | | | | | | Match the correct variable to the variable description. PR: 121173 Submitted by: Thomas Mueller <tmueller at sysgo.com> Notes: svn path=/stable/8/; revision=262590
* MFC r261075: Update EINVAL description.Sergey Kandaurov2014-01-301-2/+2
| | | | Notes: svn path=/stable/8/; revision=261282
* MFC r259921,259950:Sergey Kandaurov2014-01-142-1/+154
| | | | | | | Provide the manual page for aio_fsync(2). Notes: svn path=/stable/8/; revision=260625
* MFC r259872:Sergey Kandaurov2014-01-021-5/+1
| | | | | | | | | The compile time constant limit on number of swap devices was removed in 5.2. As such, remove the EINVAL error saying so. Currently the vm.nswapdev sysctl just represents the number of added swap devices. Notes: svn path=/stable/8/; revision=260200
* MFC 253656: Enhance the description of NOTE_TRACK:John Baldwin2013-11-051-6/+11
| | | | | | | | | | | | | | | - NOTE_TRACK has never triggered a NOTE_TRACK event from the parent pid. If NOTE_FORK is set, the listener will get a NOTE_FORK event from the parent pid, but not a separate NOTE_TRACK event. - Explicitly note that the event added to monitor the child process preserves the fflags from the original event. - Move the description of NOTE_TRACKERR under NOTE_TRACK as it is not a bit for the user to set (which is what this list pupports to be). Also, explicitly note that if an error occurs, the NOTE_CHILD event will not be generated. Notes: svn path=/stable/8/; revision=257717
* MFC 250421: posix_spawn_file_actions_adddup2(3): Document difference withJilles Tjoelker2013-08-251-2/+23
| | | | | | | | | | | dup2(). The ability to clear a file descriptor's close-on-exec flag via posix_spawn_file_actions_adddup2() is in fact proposed in Austin Group issue #411. Notes: svn path=/stable/8/; revision=254872
* MFC r250412: posix_spawn_file_actions_addopen(3): Correct error for bad fileJilles Tjoelker2013-08-251-2/+2
| | | | | | | | | | | descriptor. As per POSIX.1-2008, posix_spawn_file_actions_add* return [EBADF] if a file descriptor is negative, not [EINVAL]. The bug was only in the manual page; the code is correct. Notes: svn path=/stable/8/; revision=254869
* MFC r253380,253413: name passed into __setenv is not necessarily NUL-terminatedAndriy Gapon2013-07-241-3/+2
| | | | Notes: svn path=/stable/8/; revision=253600
* MFC r221845: Update sticky(7) cross references.Sergey Kandaurov2013-07-142-4/+4
| | | | | | | MFC reminded by: Torfinn Ingolfsen <torfinn.ingolfsen@getmail.no> Notes: svn path=/stable/8/; revision=253343
* MFC r253105:Michael Tuexen2013-07-121-0/+5
| | | | | | | | Fix the handling of SCTP_CURRENT_ASSOC and SCTP_ALL_ASSOC in sctp_opt_info(). Notes: svn path=/stable/8/; revision=253265
* MFC r253104:Michael Tuexen2013-07-121-0/+3
| | | | | | | | Fix a bug where SCTP_ENABLE_STREAM_RESET is not handled by sctp_opt_info(). Notes: svn path=/stable/8/; revision=253264
* MFC r249333:Michael Tuexen2013-07-071-202/+94
| | | | | | | | | Remove the number of addresses restriction from sctp_connectx(). Remove unused code. While there, do some cleanup of the code. Notes: svn path=/stable/8/; revision=252984
* MFC r219696:Steven Hartland2013-06-052-0/+2
| | | | | | | Add ZFS to UFS-like file systems. Notes: svn path=/stable/8/; revision=251412
* MFC 249566-249567:John Baldwin2013-05-301-1/+8
| | | | | | | | Document that sem_wait() can fail with EINTR if it is interrupted by a signal. Notes: svn path=/stable/8/; revision=251153
* MFC r248250-248251:Sergey Kandaurov2013-05-152-1/+4
| | | | | | | | - Add the getcontextx prototype to SYNOPSIS. - Link getcontextx(3) to getcontext(3). Notes: svn path=/stable/8/; revision=250682
* MFC r249471: libc: Fix typo in French translation.Jilles Tjoelker2013-04-261-1/+1
| | | | | | | | PR: kern/177704 Submitted by: martymac Notes: svn path=/stable/8/; revision=249938
* MFC r249802:Eitan Adler2013-04-262-2/+2
| | | | | | | | - sl_find does not modify 'name' - make the prototype of sl_find match NetBSD Notes: svn path=/stable/8/; revision=249913
* MFC r249801:Eitan Adler2013-04-261-10/+4
| | | | | | | Switch from K&R prototypes to modern C Notes: svn path=/stable/8/; revision=249911
* MFC r247596:Xin LI2013-04-081-1/+1
| | | | | | | | | | Fix assignment of maximum bounadary. Submitted by: Sascha Wildner <saw online de> Obtained from: DragonFly rev fd39c81ba220f7ad6e4dc9b30d45e828cf58a1ad Notes: svn path=/stable/8/; revision=249289
* When r241373 was merged, one file appears to have been missed from theGavin Atkinson2013-03-281-2/+1
| | | | | | | | | | | | | | | | | commit. Merge it: Remove undefined behavior from sranddev() and srandomdev(). This doesn't actually work with any modern C compiler: In particular, both clang and modern gcc verisons silently elide any xor operation with 'junk'. No mergeinfo changes with this commit as r241475 already updated the mergeinfo. Notes: svn path=/stable/8/; revision=248821
* MFC r246629:Michael Tuexen2013-03-081-7/+7
| | | | | | | Improve code style. No functional change. Notes: svn path=/stable/8/; revision=248020
* MFC r243302:Michael Tuexen2013-03-081-43/+42
| | | | | | | Cleanup the code a bit, which improves the portability. Notes: svn path=/stable/8/; revision=248007
* MFC r243300:Michael Tuexen2013-03-081-1/+0
| | | | | | | Fix the handling of mapped IPv6 addresses in sctp_connectx(). Notes: svn path=/stable/8/; revision=248006
* MFC r242512:Michael Tuexen2013-03-081-1/+3
| | | | | | | Fix errno in a couple of error cases. Notes: svn path=/stable/8/; revision=248000
* MFC r236959:Michael Tuexen2013-03-071-2/+3
| | | | | | | | | | Add a IP_RECVTOS socket option to receive for received UDP/IPv4 packets a cmsg of type IP_RECVTOS which contains the TOS byte. Much like IP_RECVTTL does for TTL. This allows to implement a protocol on top of UDP and implementing ECN. Notes: svn path=/stable/8/; revision=247944
* MFH (r240107,240111,240361): warn against using weak PRNGsDag-Erling Smørgrav2013-02-283-20/+29
| | | | Notes: svn path=/stable/8/; revision=247500
* MFC r246809Niclas Zeising2013-02-282-8/+8
| | | | | | | | | Change examples to be consistent with what style(9) says. Approved by: joel (mentor) Notes: svn path=/stable/8/; revision=247466
* MFH r247014, r247050 and r247051.Giorgos Keramidas2013-02-251-1/+41
| | | | | | | | | | | | | Add a sample program that shows how a custom comparison function and qsort(3) can work together to sort an array of integers. PR: docs/176197 Submitted by: Fernando, fapesteguia at opensistemas.com Christoph Mallon, christoph.mallon at gmx.de Approved by: gjb (mentor), remko (mentor) Notes: svn path=/stable/8/; revision=247276
* MFC r246476:Konstantin Belousov2013-02-211-1/+12
| | | | | | | Document the ERESTART translation to EINTR for devfs nodes. Notes: svn path=/stable/8/; revision=247084
* MFC r243779 (marcel):Xin LI2013-02-051-22/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Protect against DoS attacks, such as being described in CVE-2010-2632. The changes were derived from what has been committed to NetBSD, with modifications. These are: 1. Preserve the existsing GLOB_LIMIT behaviour by including the number of matches to the set of parameters to limit. 2. Change some of the limits to avoid impacting normal use cases: GLOB_LIMIT_STRING - change from 65536 to ARG_MAX so that glob(3) can still provide a full command line of expanded names. GLOB_LIMIT_STAT - change from 128 to 1024 for no other reason than that 128 feels too low (it's not a limit that impacts the behaviour of the test program listed in CVE-2010-2632). GLOB_LIMIT_PATH - change from 1024 to 65536 so that glob(3) can still provide a fill command line of expanded names. 3. Protect against buffer overruns when we hit the GLOB_LIMIT_STAT or GLOB_LIMIT_READDIR limits. We append SEP and EOS to pathend in those cases. Return GLOB_ABORTED instead of GLOB_NOSPACE when we would otherwise overrun the buffer. This change also modifies the existing behaviour of glob(3) in case GLOB_LIMIT is specifies by limiting the *new* matches and not all matches. This is an important distinction when GLOB_APPEND is set or when the caller uses a non-zero gl_offs. Previously pre-existing matches or the value of gl_offs would be counted in the number of matches even though the man page states that glob(3) would return GLOB_NOSPACE when gl_matchc or more matches were found. The limits that cannot be circumvented are GLOB_LIMIT_STRING and GLOB_LIMIT_PATH all others can be crossed by simply calling glob(3) again and with GLOB_APPEND set. The entire description above applies only when GLOB_LIMIT has been specified of course. No limits apply when this flag isn't set! Obtained from: Juniper Networks, Inc Notes: svn path=/stable/8/; revision=246357
* MFC r243758 (marcel):Xin LI2013-02-051-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | In globextend() when the pathv vector cannot be (re-)allocated, don't free and clear the gl_pathv pointer in the glob_t structure. Such breaks the invariant of the glob_t structure, as stated in the comment right in front of the globextend() function. If gl_pathv was non-NULL, then gl_pathc was > 0. Making gl_pathv a NULL pointer without also setting gl_pathc to 0 is wrong. Since we otherwise don't free the memory associated with a glob_t in error cases, it's unlikely that this change will cause a memory leak that wasn't already there to begin with. Callers of glob(3) must call globfree(3) irrespective of whether glob(3) returned an error or not. MFC r243759 (marcel): In globextend(), take advantage of the fact that realloc(NULL, size) is equivalent to malloc(size). This eliminates the conditional expression used for calling either realloc() or malloc() when realloc() will do all the time. Notes: svn path=/stable/8/; revision=246356
* MFC r244568:Xin LI2013-02-011-8/+4
| | | | | | | | | | | | - Reduce buffer size from LINE_MAX to PATH_MAX, there is no point to store path longer than this. - Fix an unreached case of check against sizeof buf, which in turn leads to an off-by-one nul byte write on the stack. The original condition can never be satisfied because the passed boundary is the maximum value that can be returned, so code was harmless. Notes: svn path=/stable/8/; revision=246198
* MFC r245458:Andrey Zonov2013-01-221-6/+2
| | | | | | | - Use standard RETURN VALUES section. Notes: svn path=/stable/8/; revision=245789
* MFC r245225, r245256: Restrict use of source address selectionHajimu UMEMOTO2013-01-171-2/+8
| | | | | | | of getipnodebyname(1) only to IPv6 address. Notes: svn path=/stable/8/; revision=245557
* MFC 244756 + 244757:Xin LI2013-01-114-0/+892
| | | | | | | Add Simplified Chinese catalogs. Notes: svn path=/stable/8/; revision=245278