Author: ache
Date: Wed Sep 21 15:47:40 2016
New Revision: 306109
URL: https://svnweb.freebsd.org/changeset/base/306109

Log:
  1) For already non-standard %z extension implement GNU compatible formats:
  +hh and -hh.
  2) Check for incorrect values for %z.
  
  MFC after:      7 days

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

Modified: head/lib/libc/stdtime/strptime.c
==============================================================================
--- head/lib/libc/stdtime/strptime.c    Wed Sep 21 15:29:35 2016        
(r306108)
+++ head/lib/libc/stdtime/strptime.c    Wed Sep 21 15:47:40 2016        
(r306109)
@@ -582,10 +582,16 @@ label:
                                        i *= 10;
                                        i += *buf - '0';
                                        buf++;
+                               } else if (len == 2) {
+                                       i *= 100;
+                                       break;
                                } else
                                        return (NULL);
                        }
 
+                       if (i > 1400 || (sign == -1 && i > 1200) ||
+                           (i % 100) >= 60)
+                               return (NULL);
                        tm->tm_hour -= sign * (i / 100);
                        tm->tm_min  -= sign * (i % 100);
                        *GMTp = 1;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to