Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145972463
D39687.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1012 B
Referenced Files
None
Subscribers
None
D39687.diff
View Options
diff --git a/lib/libc/stdlib/qsort.3 b/lib/libc/stdlib/qsort.3
--- a/lib/libc/stdlib/qsort.3
+++ b/lib/libc/stdlib/qsort.3
@@ -32,7 +32,7 @@
.\" @(#)qsort.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd September 30, 2022
+.Dd April 19, 2023
.Dt QSORT 3
.Os
.Sh NAME
@@ -260,7 +260,7 @@
.Fa compar
is different
.It
-if
+If
.Fa nmemb
or
.Fa size
@@ -270,7 +270,11 @@
.Fa nmemb
is not zero and
.Fa compar
-is NULL, then the runtime-constraint handler is called, and
+is
+.Dv NULL
+or
+.Fa size
+is zero, then the runtime-constraint handler is called, and
.Fn qsort_s
returns an error.
Note that the handler is called before
diff --git a/lib/libc/stdlib/qsort.c b/lib/libc/stdlib/qsort.c
--- a/lib/libc/stdlib/qsort.c
+++ b/lib/libc/stdlib/qsort.c
@@ -247,6 +247,10 @@
__throw_constraint_handler_s("qsort_s : cmp == NULL",
EINVAL);
return (EINVAL);
+ } else if (es <= 0) {
+ __throw_constraint_handler_s("qsort_s : es <= 0",
+ EINVAL);
+ return (EINVAL);
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 27, 4:03 PM (5 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29023305
Default Alt Text
D39687.diff (1012 B)
Attached To
Mode
D39687: libc: Add missing size check to qsort_s(3)
Attached
Detach File
Event Timeline
Log In to Comment