git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [Outreachy] patch-ids: fix NEEDSWORK timezone parsing in fast-import.c
@ 2025-10-09 23:49 Okhuomon Ajayi
  2025-10-09 23:57 ` Kristoffer Haugsbakk
  2025-10-10  5:30 ` Patrick Steinhardt
  0 siblings, 2 replies; 5+ messages in thread
From: Okhuomon Ajayi @ 2025-10-09 23:49 UTC (permalink / raw)
  To: git; +Cc: Okhuomon Ajayi

Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
---
 builtin/fast-import.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 606c6aea82..695e1a0ae1 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -1959,14 +1959,15 @@ static int validate_raw_date(const char *src, struct strbuf *result, int strict)
 		return -1;
 
 	num = strtoul(src + 1, &endp, 10);
-	/*
-	 * NEEDSWORK: check for brokenness other than num > 1400, such as
-	 *            (num % 100) >= 60, or ((num % 100) % 15) != 0 ?
-	 */
-	if (errno || endp == src + 1 || *endp || /* did not parse */
-	    (strict && (1400 < num))             /* parsed a broken timezone */
-	   )
+	
+
+        unsigned int hours = num / 100;
+        unsigned int minutes = num % 100;
+
+	if (errno || endp == src + 1 || *endp || 
+	    (strict && (num > 1400 || minutes >=60 || minutes % 15 != 0))){
 		return -1;
+	}
 
 	strbuf_addstr(result, orig_src);
 	return 0;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-10-10 17:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 23:49 [PATCH] [Outreachy] patch-ids: fix NEEDSWORK timezone parsing in fast-import.c Okhuomon Ajayi
2025-10-09 23:57 ` Kristoffer Haugsbakk
2025-10-10  5:30 ` Patrick Steinhardt
2025-10-10 15:45   ` Junio C Hamano
2025-10-10 17:16     ` Okhuomon Ajayi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).