Author: ache
Date: Tue Oct  7 06:34:05 2014
New Revision: 272679
URL: https://svnweb.freebsd.org/changeset/base/272679

Log:
  1) Fix the case we have less arguments for format string than we expected.
  2) Return error on unsupported format specs.
  (both according to POSIX)
  
  PR:     93197

Modified:
  head/lib/libc/stdtime/strptime.c

Modified: head/lib/libc/stdtime/strptime.c
==============================================================================
--- head/lib/libc/stdtime/strptime.c    Tue Oct  7 06:02:08 2014        
(r272678)
+++ head/lib/libc/stdtime/strptime.c    Tue Oct  7 06:34:05 2014        
(r272679)
@@ -103,9 +103,6 @@ _strptime(const char *buf, const char *f
 
        ptr = fmt;
        while (*ptr != 0) {
-               if (*buf == 0)
-                       break;
-
                c = *ptr++;
 
                if (c != '%') {
@@ -123,7 +120,6 @@ _strptime(const char *buf, const char *f
 label:
                c = *ptr++;
                switch (c) {
-               case 0:
                case '%':
                        if (*buf++ != '%')
                                return (NULL);
@@ -600,6 +596,9 @@ label:
                        while (isspace_l((unsigned char)*buf, locale))
                                buf++;
                        break;
+
+               default:
+                       return (NULL);
                }
        }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to