svn commit: r339241 - head/lib/libc/stdtime

Konstantin Belousov kib at FreeBSD.org
Mon Oct 8 18:45:42 UTC 2018


Author: kib
Date: Mon Oct  8 18:45:40 2018
New Revision: 339241
URL: https://svnweb.freebsd.org/changeset/base/339241

Log:
  Disallow zero day of month from strptime("%d").
  
  It is required by POSIX, specified in our man page, and followed by
  Linux.
  
  PR:	232072
  Reported by:	miguel_tete17 at hotmail.com
  Sponsored by:	The FreeBSD Foundation
  Approved by:	re (gjb)
  MFC after:	1 week

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

Modified: head/lib/libc/stdtime/strptime.c
==============================================================================
--- head/lib/libc/stdtime/strptime.c	Mon Oct  8 18:06:40 2018	(r339240)
+++ head/lib/libc/stdtime/strptime.c	Mon Oct  8 18:45:40 2018	(r339241)
@@ -419,7 +419,7 @@ label:
 				i += *buf - '0';
 				len--;
 			}
-			if (i > 31)
+			if (i == 0 || i > 31)
 				return (NULL);
 
 			tm->tm_mday = i;


More information about the svn-src-head mailing list