Index: lib/util_unistr.c
===================================================================
RCS file: /home/cvsroot/dcerpc/tng/source/lib/util_unistr.c,v
retrieving revision 1.29
diff -u -p -r1.29 util_unistr.c
--- lib/util_unistr.c	28 May 2007 15:25:28 -0000	1.29
+++ lib/util_unistr.c	30 Jun 2009 19:35:56 -0000
@@ -311,9 +311,11 @@ char *uni_strncpy(char *destbuf, const c
 }
 
 
-/*******************************************************************
-  Convert a 'multi-string' buffer to space-separated ASCII.
- ********************************************************************/
+/**
+ * Convert a 'multi-string' buffer to space-separated ASCII.
+ *
+ * \deprecated Please use buffer2_to_multistr2()
+ */
 void buffer2_to_multistr(char *dest, const BUFFER2 *str, size_t maxlen)
 {
 	char *destend;
@@ -335,6 +337,49 @@ void buffer2_to_multistr(char *dest, con
 	*dest = 0;
 }
 
+
+/**
+ * Convert a BUFFER2 with a multi string to unix codepage
+ *
+ * replace_NULs: If set, all the NUL (delimiting the multi
+ *   strings are replaced by it
+ */
+size_t buffer2_to_multistr2(const BUFFER2 *str,
+			    char **allocated, char replace_NULs)
+{
+	void *conv_res;
+	char *retbuf;
+	size_t retval;
+	const void *src = str->buffer;
+
+	g_return_val_if_fail(allocated != NULL, 0);
+	*allocated = NULL;
+
+	retval = convert_string_allocate(CH_UCS2, CH_UNIX, src, str->buf_len,
+					 &conv_res);
+	retbuf = (char *) conv_res;
+	if (retval == (size_t)-1)
+		return 0;
+
+	if (replace_NULs != '\0')
+	{
+		size_t i;
+		if (! g_xrenew(char, &retbuf, retval + 1))
+			retval--;
+		retbuf[retval] = '\0';
+		for (i = 0; i < retval; i++)
+		{
+			if (retbuf[i] == 0)
+				retbuf[i] = replace_NULs;
+		}
+	}
+
+	*allocated =  retbuf;
+
+	return retval;
+}
+
+
 /*******************************************************************
   Convert a buffer4 to space-separated ASCII.
  ********************************************************************/
Index: rpcclient/display_reg.c
===================================================================
RCS file: /home/cvsroot/dcerpc/tng/source/rpcclient/display_reg.c,v
retrieving revision 1.15
diff -u -p -r1.15 display_reg.c
--- rpcclient/display_reg.c	4 May 2006 16:42:29 -0000	1.15
+++ rpcclient/display_reg.c	30 Jun 2009 19:35:56 -0000
@@ -64,7 +64,6 @@ static void print_reg_value(FILE *out_hn
 				uint32 val_type, const BUFFER2 *value)
 {
 	const char *type;
-	fstring valstr;
 
 	type = get_reg_val_type_str(val_type);
 
@@ -114,8 +113,11 @@ static void print_reg_value(FILE *out_hn
 
 		case REGVAL_SZ_MULTI:
 		{
-			buffer2_to_multistr(valstr, value, sizeof(valstr));
-			report(out_hnd, "\t%s:\t%s:\t%s\n", val_name, type, valstr);
+		        char *valstr;
+			buffer2_to_multistr2(value, &valstr, ' ');
+			report(out_hnd, "\t%s:\t%s:\t%s\n",
+			       val_name, type, valstr);
+			safe_free(valstr);
 			break;
 		}
 	}
