Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Oct 2018 18:45:41 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339241 - head/lib/libc/stdtime
Message-ID:  <201810081845.w98IjfKc005215@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810081845.w98IjfKc005215>