--- old/usr/src/cmd/mdb/common/mdb/mdb_cmds.c	2013-11-29 20:18:34.807459155 -0500
+++ new/usr/src/cmd/mdb/common/mdb/mdb_cmds.c	2013-11-29 20:18:34.813362949 -0500
@@ -27,6 +27,7 @@
 /*
  * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright (c) 2013 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  */
 
 #include <sys/elf.h>
@@ -1563,11 +1564,6 @@
 	if (version == NULL)
 		version = "Unknown";
 
-	/*
-	 * The hash table implementation in OVERLOAD mode limits the version
-	 * name to 31 characters because we cannot specify an external name.
-	 * The full version name is available via the ::objects dcmd if needed.
-	 */
 	(void) mdb_nv_insert(vers_nv, version, NULL, (uintptr_t)objname,
 	    MDB_NV_OVERLOAD);
 
--- old/usr/src/cmd/mdb/common/mdb/mdb_nv.c	2013-11-29 20:18:35.086955264 -0500
+++ new/usr/src/cmd/mdb/common/mdb/mdb_nv.c	2013-11-29 20:18:35.094034107 -0500
@@ -23,8 +23,9 @@
  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2013 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ */
 
 #include <mdb/mdb_debug.h>
 #include <mdb/mdb_string.h>
@@ -38,7 +39,7 @@
 
 #define	NV_SIZE(v) \
 	(((v)->v_flags & MDB_NV_EXTNAME) ? sizeof (mdb_var_t) : \
-	sizeof (mdb_var_t) + MDB_NV_NAMELEN - 1)
+	sizeof (mdb_var_t) + strlen((v)->v_lname))
 
 #define	NV_HASHSZ	211
 
@@ -66,20 +67,28 @@
 nv_var_alloc(const char *name, const mdb_nv_disc_t *disc,
 	uintmax_t value, uint_t flags, uint_t um_flags, mdb_var_t *next)
 {
-	size_t nbytes = (flags & MDB_NV_EXTNAME) ? sizeof (mdb_var_t) :
-	    (sizeof (mdb_var_t) + MDB_NV_NAMELEN - 1);
+	size_t nbytes;
+	mdb_var_t *v;
+
+	if (flags & MDB_NV_EXTNAME)
+		nbytes = sizeof (mdb_var_t);
+	else
+		nbytes = sizeof (mdb_var_t) + strlen(name);
 
-	mdb_var_t *v = mdb_alloc(nbytes, um_flags);
+	v = mdb_alloc(nbytes, um_flags);
 
 	if (v == NULL)
 		return (NULL);
 
 	if (flags & MDB_NV_EXTNAME) {
 		v->v_ename = name;
-		v->v_lname[0] = 0;
+		v->v_lname[0] = '\0';
 	} else {
-		(void) strncpy(v->v_lname, name, MDB_NV_NAMELEN - 1);
-		v->v_lname[MDB_NV_NAMELEN - 1] = '\0';
+		/*
+		 * We don't overflow here since the mdb_var_t itself has
+		 * room for the trailing \0.
+		 */
+		(void) strcpy(v->v_lname, name);
 		v->v_ename = NULL;
 	}
 
--- old/usr/src/cmd/mdb/common/mdb/mdb_nv.h	2013-11-29 20:18:35.256733486 -0500
+++ new/usr/src/cmd/mdb/common/mdb/mdb_nv.h	2013-11-29 20:18:35.262339516 -0500
@@ -23,12 +23,13 @@
  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+/*
+ * Copyright (c) 2013 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ */
 
 #ifndef	_MDB_NV_H
 #define	_MDB_NV_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 
 #ifdef	__cplusplus
@@ -37,6 +38,11 @@
 
 #ifdef _MDB
 
+/*
+ * There used to be a cap (MDB_NV_NAMELEN bytes including null) on the
+ * length of variable names stored in-line.  This cap is no longer there,
+ * however parts of mdb use the constant to sanitize input.
+ */
 #define	MDB_NV_NAMELEN	31	/* Max variable name length including null */
 
 /*
@@ -74,8 +80,8 @@
  * we make a few simple space optimizations:
  *
  * A variable's name can be a pointer to external storage (v_ename and
- * MDB_NV_EXTNAME set), or it can be stored locally (MDB_NV_NAMELEN - 1
- * bytes of storage are allocated immediately after v_lname[0]).
+ * MDB_NV_EXTNAME set), or it can be stored locally (bytes of storage are
+ * allocated immediately after v_lname[0]).
  *
  * A variable may have multiple definitions (v_ndef chain), but this feature
  * is mutually exclusive with MDB_NV_EXTNAME in order to save space.
--- old/usr/src/cmd/mdb/common/mdb/mdb_tab.c	2013-11-29 20:18:35.414170961 -0500
+++ new/usr/src/cmd/mdb/common/mdb/mdb_tab.c	2013-11-29 20:18:35.420079202 -0500
@@ -21,6 +21,7 @@
 /*
  * Copyright (c) 2013 by Delphix. All rights reserved.
  * Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  */
 /*
  * This file contains all of the interfaces for mdb's tab completion engine.
@@ -394,11 +395,8 @@
 void
 mdb_tab_insert(mdb_tab_cookie_t *mcp, const char *name)
 {
-	size_t len, matches, index;
-	uint_t flags;
+	size_t matches, index;
 	mdb_var_t *v;
-	char *n;
-	const char *nvn;
 
 	/*
 	 * If we have a match set, then we want to verify that we actually match
@@ -412,34 +410,15 @@
 	if (v != NULL)
 		return;
 
-	/*
-	 * Names that we get passed in may be longer than MDB_NV_NAMELEN which
-	 * is currently 31 including the null terminator. If that is the case,
-	 * then we're going to take care of allocating a string and holding it
-	 * for our caller. Note that we don't need to free it, because we're
-	 * allocating this with UM_GC.
-	 */
-	flags = 0;
-	len = strlen(name);
-	if (len > MDB_NV_NAMELEN - 1) {
-		n = mdb_alloc(len + 1, UM_SLEEP | UM_GC);
-		(void) strcpy(n, name);
-		nvn = n;
-		flags |= MDB_NV_EXTNAME;
-	} else {
-		nvn = name;
-	}
-	flags |= MDB_NV_RDONLY;
-
-	(void) mdb_nv_insert(&mcp->mtc_nv, nvn, NULL, 0, flags);
+	(void) mdb_nv_insert(&mcp->mtc_nv, name, NULL, 0, MDB_NV_RDONLY);
 
 	matches = mdb_tab_size(mcp);
 	if (matches == 1) {
-		(void) strlcpy(mcp->mtc_match, nvn, MDB_SYM_NAMLEN);
+		(void) strlcpy(mcp->mtc_match, name, MDB_SYM_NAMLEN);
 	} else {
 		index = 0;
 		while (mcp->mtc_match[index] &&
-		    mcp->mtc_match[index] == nvn[index])
+		    mcp->mtc_match[index] == name[index])
 			index++;
 
 		mcp->mtc_match[index] = '\0';
