In sbuf_new_for_sysctl(), default the buffer size to 64 bytes if the
passed-in pointer is NULL and the length is zero.
This commit is contained in:
parent
1596158c05
commit
2834924513
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=280192
@ -1807,6 +1807,9 @@ sbuf_new_for_sysctl(struct sbuf *s, char *buf, int length,
|
|||||||
struct sysctl_req *req)
|
struct sysctl_req *req)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* Supply a default buffer size if none given. */
|
||||||
|
if (buf == NULL && length == 0)
|
||||||
|
length = 64;
|
||||||
s = sbuf_new(s, buf, length, SBUF_FIXEDLEN | SBUF_INCLUDENUL);
|
s = sbuf_new(s, buf, length, SBUF_FIXEDLEN | SBUF_INCLUDENUL);
|
||||||
sbuf_set_drain(s, sbuf_sysctl_drain, req);
|
sbuf_set_drain(s, sbuf_sysctl_drain, req);
|
||||||
return (s);
|
return (s);
|
||||||
|
Loading…
Reference in New Issue
Block a user