From owner-freebsd-bugs Wed Sep 22 12:30:24 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id D92C215414 for ; Wed, 22 Sep 1999 12:30:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id MAA94835; Wed, 22 Sep 1999 12:30:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from chronis.pobox.com (chronis.pobox.com [208.210.124.49]) by hub.freebsd.org (Postfix) with ESMTP id C046F14A29 for ; Wed, 22 Sep 1999 12:29:46 -0700 (PDT) (envelope-from scott@chronis.pobox.com) Received: by chronis.pobox.com (Postfix, from userid 1001) id 7BF689B46; Wed, 22 Sep 1999 15:29:45 -0400 (EDT) Message-Id: <19990922192945.7BF689B46@chronis.pobox.com> Date: Wed, 22 Sep 1999 15:29:45 -0400 (EDT) From: scott@chronis.pobox.com Reply-To: scott@chronis.pobox.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/13901: strptime breaks when handling some numerical fields Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 13901 >Category: bin >Synopsis: strptime breaks when handling some numerical fields >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Sep 22 12:30:01 PDT 1999 >Closed-Date: >Last-Modified: >Originator: scott >Release: FreeBSD 3.3-STABLE i386 >Organization: IC Group, Inc. >Environment: >Description: Whenever a numeric data is expected by strptime() in it's `buf' argument, it will allocate too many digits to any field which is followed by a digit or string of digits in `buf'. >How-To-Repeat: #include struct tm t; strptime("19990823", "%Y%m%d", &t); /* fails */ strptime("199911", "%Y11", &t); /* fails */ strptime("0711", "%m%d", &t); /* fails */ >Fix: 170c170,171 < for (i = 0; *buf != 0 && isdigit((unsigned char)*buf); buf++) { --- > len = 0; > for (i = 0; *buf != 0 && isdigit((unsigned char)*buf) && len < 3; buf++) { 172a174 > len++; 187,188c189,190 < < for (i = 0; *buf != 0 && isdigit((unsigned char)*buf); buf++) { --- > len = 0; > for (i = 0; *buf != 0 && isdigit((unsigned char)*buf) && len < 2; buf++) { 190a193 > len++; 211,212c214,215 < < for (i = 0; *buf != 0 && isdigit((unsigned char)*buf); buf++) { --- > len = 0; > for (i = 0; *buf != 0 && isdigit((unsigned char)*buf) && len < 2; buf++) { 214a218 > len++; 278,279c282,283 < < for (i = 0; *buf != 0 && isdigit((unsigned char)*buf); buf++) { --- > len = 0; > for (i = 0; *buf != 0 && isdigit((unsigned char)*buf) && len < 2; buf++) { 281a286 > len++; 319,320c324,325 < < for (i = 0; *buf != 0 && isdigit((unsigned char)*buf); buf++) { --- > len = 0; > for (i = 0; *buf != 0 && isdigit((unsigned char)*buf) && len < 2; buf++) { 322a328 > len++; 341a348 > len = 0; 344a352,356 > if ((c == 'y' && len >= 1) || (c == 'Y' && len >= 3)) { > buf++; > break; > } > len++; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message