kernel - sysctl - use a larger buffer to ensure that a ksnprintf() fits
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 1 Dec 2011 04:39:02 +0000 (20:39 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 1 Dec 2011 04:39:02 +0000 (20:39 -0800)
* Use a larger buffer to ensure that a ksnprintf() fits.  This doesn't
  fix any bugs per-say but it does ensure that any normal integer OID
  will be properly displayed.

* No current sysctls have OIDs large enough to have triggered the problem.

sys/kern/kern_sysctl.c

index 24bf124..d313c68 100644 (file)
@@ -557,12 +557,12 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS)
        int error = 0;
        struct sysctl_oid *oid;
        struct sysctl_oid_list *lsp = &sysctl__children, *lsp2;
-       char buf[10];
+       char buf[16];
 
        sysctl_lock(LK_SHARED);
        while (namelen) {
                if (!lsp) {
-                       ksnprintf(buf,sizeof(buf),"%d",*name);
+                       ksnprintf(buf, sizeof(buf), "%d", *name);
                        if (req->oldidx)
                                error = SYSCTL_OUT(req, ".", 1);
                        if (!error)