Index: kernel/generic/include/string.h
===================================================================
--- kernel/generic/include/string.h	(revision 59ee56f5d1605d18a8cd8c88a34ea28e88a14ad2)
+++ kernel/generic/include/string.h	(revision 089d746548cf1ac3708cf3274d20bba32a0efed4)
@@ -87,5 +87,5 @@
 extern void str_cpy(char *dest, size_t size, const char *src);
 extern void str_ncpy(char *dest, size_t size, const char *src, size_t n);
-extern void wstr_nstr(char *dst, const wchar_t *src, size_t size);
+extern void wstr_to_str(char *dest, size_t size, const wchar_t *src);
 
 extern char *str_chr(const char *str, wchar_t ch);
Index: kernel/generic/src/console/kconsole.c
===================================================================
--- kernel/generic/src/console/kconsole.c	(revision 59ee56f5d1605d18a8cd8c88a34ea28e88a14ad2)
+++ kernel/generic/src/console/kconsole.c	(revision 089d746548cf1ac3708cf3274d20bba32a0efed4)
@@ -289,5 +289,5 @@
 			
 			char tmp[STR_BOUNDS(MAX_CMDLINE)];
-			wstr_nstr(tmp, current + beg, position - beg + 1);
+			wstr_to_str(tmp, position - beg + 1, current + beg);
 			
 			int found;
@@ -665,5 +665,5 @@
 		
 		char cmdline[STR_BOUNDS(MAX_CMDLINE)];
-		wstr_nstr(cmdline, tmp, STR_BOUNDS(MAX_CMDLINE));
+		wstr_to_str(cmdline, STR_BOUNDS(MAX_CMDLINE), tmp);
 		
 		if ((!kcon) && (len == 4) && (str_lcmp(cmdline, "exit", 4) == 0))
Index: kernel/generic/src/lib/string.c
===================================================================
--- kernel/generic/src/lib/string.c	(revision 59ee56f5d1605d18a8cd8c88a34ea28e88a14ad2)
+++ kernel/generic/src/lib/string.c	(revision 089d746548cf1ac3708cf3274d20bba32a0efed4)
@@ -537,5 +537,5 @@
  * null-terminated and containing only complete characters.
  *
- * @param dst   Destination buffer.
+ * @param dest   Destination buffer.
  * @param count Size of the destination buffer (must be > 0).
  * @param src   Source string.
@@ -571,5 +571,5 @@
  * have to be null-terminated.
  *
- * @param dst   Destination buffer.
+ * @param dest   Destination buffer.
  * @param count Size of the destination buffer (must be > 0).
  * @param src   Source string.
@@ -596,36 +596,32 @@
 }
 
-/** Copy NULL-terminated wide string to string
- *
- * Copy source wide string @a src to destination buffer @a dst.
- * No more than @a size bytes are written. NULL-terminator is always
- * written after the last succesfully copied character (i.e. if the
- * destination buffer is has at least 1 byte, it will be always
- * NULL-terminated).
- *
- * @param src   Source wide string.
- * @param dst   Destination buffer.
- * @param count Size of the destination buffer.
- *
- */
-void wstr_nstr(char *dst, const wchar_t *src, size_t size)
-{
-	/* No space for the NULL-terminator in the buffer */
-	if (size == 0)
-		return;
-	
+/** Convert wide string to string.
+ *
+ * Convert wide string @a src to string. The output is written to the buffer
+ * specified by @a dest and @a size. @a size must be non-zero and the string
+ * written will always be well-formed.
+ *
+ * @param dest	Destination buffer.
+ * @param size	Size of the destination buffer.
+ * @param src	Source wide string.
+ */
+void wstr_to_str(char *dest, size_t size, const wchar_t *src)
+{
 	wchar_t ch;
-	size_t src_idx = 0;
-	size_t dst_off = 0;
+	size_t src_idx;
+	size_t dest_off;
+
+	/* There must be space for a null terminator in the buffer. */
+	ASSERT(size > 0);
+
+	src_idx = 0;
+	dest_off = 0;
 	
 	while ((ch = src[src_idx++]) != 0) {
-		if (chr_encode(ch, dst, &dst_off, size) != EOK)
+		if (chr_encode(ch, dest, &dest_off, size - 1) != EOK)
 			break;
 	}
-	
-	if (dst_off >= size)
-		dst[size - 1] = 0;
-	else
-		dst[dst_off] = 0;
+
+	dest[dest_off] = '\0';
 }
 
