FreeBSD Bugzilla – Attachment 13355 Details for
Bug 25476
[PATCH] The syscall oldgetkerninfo can return bogus values.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.87 KB, created by
un1i
on 2001-03-01 15:20:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
un1i
Created:
2001-03-01 15:20:01 UTC
Size:
1.87 KB
patch
obsolete
>Index: kern_sysctl.c >=================================================================== >RCS file: /ncvs/src/sys/kern/kern_sysctl.c,v >retrieving revision 1.105 >diff -u -r1.105 kern_sysctl.c >--- kern_sysctl.c 2001/02/04 13:12:22 1.105 >+++ kern_sysctl.c 2001/03/01 14:58:26 >@@ -1217,6 +1217,7 @@ > { > int error, name[6]; > size_t size; >+ u_int needed = 0; > > switch (uap->op & 0xff00) { > >@@ -1280,16 +1281,15 @@ > * this is pretty crude, but it's just enough for uname() > * from BSDI's 1.x libc to work. > * >- * In particular, it doesn't return the same results when >- * the supplied buffer is too small. BSDI's version apparently >- * will return the amount copied, and set the *size to how >- * much was needed. The emulation framework here isn't capable >- * of that, so we just set both to the amount copied. >- * BSDI's 2.x product apparently fails with ENOMEM in this >- * scenario. >+ * *size gives the size of the buffer before the call, and >+ * the amount of data copied after a successful call. >+ * If successful, the return value is the amount of data >+ * available, which can be larger than *size. >+ * >+ * BSDI's 2.x product apparently fails with ENOMEM if *size >+ * is too small. > */ > >- u_int needed; > u_int left; > char *s; > >@@ -1312,13 +1312,15 @@ > > needed = sizeof(bsdi_si) + (s - bsdi_strings); > >- if (uap->where == NULL) { >+ if ((uap->where == NULL) || (uap->size == NULL)) { > /* process is asking how much buffer to supply.. */ > size = needed; > error = 0; > break; > } > >+ if ((error = copyin(uap->size, &size, sizeof(size))) != 0) >+ break; > > /* if too much buffer supplied, trim it down */ > if (size > needed) >@@ -1344,7 +1346,7 @@ > } > if (error) > return (error); >- p->p_retval[0] = size; >+ p->p_retval[0] = needed ? needed : size; > if (uap->size) > error = copyout((caddr_t)&size, (caddr_t)uap->size, > sizeof(size));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 25476
: 13355