about summary refs log tree commit diff
path: root/stdlib/strfmon.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/strfmon.c')
-rw-r--r--stdlib/strfmon.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/stdlib/strfmon.c b/stdlib/strfmon.c
index 54771049ad..c956ae3040 100644
--- a/stdlib/strfmon.c
+++ b/stdlib/strfmon.c
@@ -170,6 +170,13 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
 	    {
 	    case '=':			/* Set fill character.  */
 	      pad = *++fmt;
+	      if (pad == '\0')
+		{
+		  /* Premature EOS.  */
+		  __set_errno (EINVAL);
+		  va_end (ap);
+		  return -1;
+		}
 	      continue;
 	    case '^':			/* Don't group digits.  */
 	      group = 0;