Page MenuHomeFreeBSD

D21152.id60432.diff
No OneTemporary

D21152.id60432.diff

Index: lib/libc/gen/auxv.3
===================================================================
--- lib/libc/gen/auxv.3
+++ lib/libc/gen/auxv.3
@@ -82,5 +82,3 @@
.Sh BUGS
Only a small subset of available auxiliary info vector items are
accessible with this function.
-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
@@ -140,8 +140,8 @@
switch (aux) {
case AT_CANARY:
- if (canary != NULL && canary_len >= buflen) {
- memcpy(buf, canary, buflen);
+ if (canary != NULL && buflen >= canary_len) {
+ memcpy(buf, canary, canary_len);
memset(canary, 0, canary_len);
canary = NULL;
res = 0;
@@ -149,21 +149,21 @@
res = ENOENT;
break;
case AT_HWCAP:
- if (hwcap_present && buflen == sizeof(u_long)) {
+ if (hwcap_present && buflen >= sizeof(u_long)) {
*(u_long *)buf = hwcap;
res = 0;
} else
res = ENOENT;
break;
case AT_HWCAP2:
- if (hwcap2_present && buflen == sizeof(u_long)) {
+ if (hwcap2_present && buflen >= sizeof(u_long)) {
*(u_long *)buf = hwcap2;
res = 0;
} else
res = ENOENT;
break;
case AT_NCPUS:
- if (buflen == sizeof(int)) {
+ if (buflen >= sizeof(int)) {
if (ncpus != 0) {
*(int *)buf = ncpus;
res = 0;
@@ -173,14 +173,14 @@
res = EINVAL;
break;
case AT_PAGESIZES:
- if (pagesizes != NULL && pagesizes_len >= buflen) {
- memcpy(buf, pagesizes, buflen);
+ if (pagesizes != NULL && buflen >= pagesizes_len) {
+ memcpy(buf, pagesizes, pagesizes_len);
res = 0;
} else
res = ENOENT;
break;
case AT_PAGESZ:
- if (buflen == sizeof(int)) {
+ if (buflen >= sizeof(int)) {
if (pagesize != 0) {
*(int *)buf = pagesize;
res = 0;
@@ -190,7 +190,7 @@
res = EINVAL;
break;
case AT_OSRELDATE:
- if (buflen == sizeof(int)) {
+ if (buflen >= sizeof(int)) {
if (osreldate != 0) {
*(int *)buf = osreldate;
res = 0;
@@ -200,7 +200,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
Tue, Jul 28, 5:54 AM (1 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35636358
Default Alt Text
D21152.id60432.diff (2 KB)

Event Timeline