From owner-svn-src-all@FreeBSD.ORG Tue Oct 7 06:34:06 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0FADBE40; Tue, 7 Oct 2014 06:34:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFD35C3F; Tue, 7 Oct 2014 06:34:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s976Y5cc084777; Tue, 7 Oct 2014 06:34:05 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s976Y5CS084776; Tue, 7 Oct 2014 06:34:05 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201410070634.s976Y5CS084776@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Tue, 7 Oct 2014 06:34:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272679 - head/lib/libc/stdtime X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 06:34:06 -0000 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); } }