Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Oct 2014 06:34:05 +0000 (UTC)
From:      "Andrey A. Chernov" <ache@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272679 - head/lib/libc/stdtime
Message-ID:  <201410070634.s976Y5CS084776@svn.freebsd.org>

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



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