git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] date.c: Fix off by one error in object-header date parsing

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 12, 2012, 20:50 UTC
Message-ID
<7vsjcwael5.fsf@alter.siamese.dyndns.org>

It is perfectly OK for a valid decimal integer to begin with '9' but 116eb3a (parse_date(): allow ancient git-timestamp, 2012-02-02) did not express the range correctly.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 date.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/date.c b/date.c
index bf8e088..67b3d66 100644
--- a/date.c
+++ b/date.c
@@ -595,7 +595,7 @@ static int match_object_header_date(const char *date, unsigned long *timestamp,
 	unsigned long stamp;
 	int ofs;
 
-	if (*date < '0' || '9' <= *date)
+	if (*date < '0' || '9' < *date)
 		return -1;
 	stamp = strtoul(date, &end, 10);
 	if (*end != ' ' || stamp == ULONG_MAX || (end[1] != '+' && end[1] != '-'))
-- 
1.7.11.2
Message 1 of 1 in “date.c: Fix off by one error in object-header date parsing”
  1. date.c: Fix off by one error in object-header date parsingJunio C Hamano, Jul 12, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.