Page MenuHomeFreeBSD

D21152.id60444.diff
No OneTemporary

D21152.id60444.diff

Index: lib/libc/gen/auxv.3
===================================================================
--- lib/libc/gen/auxv.3
+++ lib/libc/gen/auxv.3
@@ -116,6 +116,3 @@
.Fn elf_aux_info
function appeared in
.Fx 12.0 .
-.Sh BUGS
-Some items require a "right-sized" buffer while others just require a
-"big enough" buffer.
Index: lib/libc/gen/auxv.c
===================================================================
--- lib/libc/gen/auxv.c
+++ lib/libc/gen/auxv.c
@@ -219,9 +219,9 @@
res = EINVAL;
break;
case AT_CANARY:
- if (canary_len >= buflen) {
+ if (buflen >= canary_len) {
if (canary != NULL) {
- memcpy(buf, canary, buflen);
+ memcpy(buf, canary, canary_len);
memset(canary, 0, canary_len);
canary = NULL;
res = 0;
@@ -315,7 +315,7 @@
res = EINVAL;
break;
case AT_HWCAP:
- if (buflen == sizeof(u_long)) {
+ if (buflen >= sizeof(u_long)) {
if (hwcap_present) {
*(u_long *)buf = hwcap;
res = 0;
@@ -325,7 +325,7 @@
res = EINVAL;
break;
case AT_HWCAP2:
- if (buflen == sizeof(u_long)) {
+ if (buflen >= sizeof(u_long)) {
if (hwcap2_present) {
*(u_long *)buf = hwcap2;
res = 0;
@@ -335,7 +335,7 @@
res = EINVAL;
break;
case AT_NCPUS:
- if (buflen == sizeof(int)) {
+ if (buflen >= sizeof(int)) {
if (ncpus != 0) {
*(int *)buf = ncpus;
res = 0;
@@ -345,9 +345,9 @@
res = EINVAL;
break;
case AT_PAGESIZES:
- if (pagesizes_len >= buflen) {
+ if (buflen >= pagesizes_len) {
if (pagesizes != NULL) {
- memcpy(buf, pagesizes, buflen);
+ memcpy(buf, pagesizes, pagesizes_len);
res = 0;
} else
res = ENOENT;
@@ -365,7 +365,7 @@
res = EINVAL;
break;
case AT_PAGESZ:
- if (buflen == sizeof(int)) {
+ if (buflen >= sizeof(int)) {
if (pagesize != 0) {
*(int *)buf = pagesize;
res = 0;
@@ -405,7 +405,7 @@
res = EINVAL;
break;
case AT_OSRELDATE:
- if (buflen == sizeof(int)) {
+ if (buflen >= sizeof(int)) {
if (osreldate != 0) {
*(int *)buf = osreldate;
res = 0;
@@ -425,7 +425,7 @@
res = EINVAL;
break;
case AT_TIMEKEEP:
- if (buflen == sizeof(void *)) {
+ if (buflen >= sizeof(void *)) {
if (timekeep != NULL) {
*(void **)buf = timekeep;
res = 0;

File Metadata

Mime Type
text/plain
Expires
Thu, Aug 27, 3:55 AM (11 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37302183
Default Alt Text
D21152.id60444.diff (2 KB)

Event Timeline