diff options
| author | Faraz Vahedi <kfv@kfv.io> | 2026-06-02 09:12:59 +0000 |
|---|---|---|
| committer | Robert Clausecker <fuz@FreeBSD.org> | 2026-06-07 20:59:19 +0000 |
| commit | 26a1180cd1521e4c438ac95a57b134e27ea0a72d (patch) | |
| tree | 4f46d814db50bdb40ac4cdf1d063893db65261cb | |
| parent | 3501eec9dd39b527a46e82de53480968d283b90e (diff) | |
qsort.3: Document mergesort() behaviour on size overflow
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Pull Request: https://github.com/freebsd/freebsd-src/pull/2243
Reviewed by: fuz
MFC after: 1 week
| -rw-r--r-- | lib/libc/stdlib/qsort.3 | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libc/stdlib/qsort.3 b/lib/libc/stdlib/qsort.3 index e2e29e7cf04f..6b09d57524bf 100644 --- a/lib/libc/stdlib/qsort.3 +++ b/lib/libc/stdlib/qsort.3 @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 25, 2024 +.Dd June 2, 2026 .Dt QSORT 3 .Os .Sh NAME @@ -362,13 +362,21 @@ functions succeed unless: .It Bq Er EINVAL The .Fa size -argument is zero, or, +argument is zero, the .Fa size argument to .Fn mergesort is less than -.Dq "sizeof(void *) / 2" . +.Dq "sizeof(void *) / 2" , +or +the +.Fa nmemb +and +.Fa size +arguments to +.Fn mergesort +describe an unrepresentable buffer size. .It Bq Er ENOMEM The .Fn heapsort |
