Index: kernel/generic/src/printf/printf_core.c
===================================================================
--- kernel/generic/src/printf/printf_core.c	(revision d11a1811118ec8e5eb8ca4beae291275a4ce36b6)
+++ kernel/generic/src/printf/printf_core.c	(revision 64a617f6ba5e1f774278f10d16694f0f68506479)
@@ -284,5 +284,5 @@
 	/* Print leading spaces. */
 	size_t strw = str_length(str);
-	if (precision == 0)
+	if ((precision == 0) || (precision > strw))
 		precision = strw;
 	
@@ -332,5 +332,5 @@
 	/* Print leading spaces. */
 	size_t strw = wstr_length(str);
-	if (precision == 0)
+	if ((precision == 0) || (precision > strw))
 		precision = strw;
 	
Index: kernel/test/print/print1.c
===================================================================
--- kernel/test/print/print1.c	(revision d11a1811118ec8e5eb8ca4beae291275a4ce36b6)
+++ kernel/test/print/print1.c	(revision 64a617f6ba5e1f774278f10d16694f0f68506479)
@@ -41,5 +41,5 @@
 	
 	TPRINTF("Testing printf(\"%%8.10s\", \"text\"):\n");
-	TPRINTF("Expected output: \"text\"\n");
+	TPRINTF("Expected output: \"    text\"\n");
 	TPRINTF("Real output:     \"%8.10s\"\n\n", "text");
 	
@@ -48,4 +48,8 @@
 	TPRINTF("Real output:     \"%8.10s\"\n\n", "very long text");
 	
+	TPRINTF("Testing printf(\"%%-*.*s\", 7, 7, \"text\"):\n");
+	TPRINTF("Expected output: \"text   \"\n");
+	TPRINTF("Real output:     \"%-*.*s\"\n\n", 7, 7, "text");
+	
 	return NULL;
 }
