git: 29e0580acd22 - main - sysutils/agedu: Fix infinite loop in round_and_format_age

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Thu, 17 Oct 2024 19:06:22 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=29e0580acd222be65307c398748bdb869015233f

commit 29e0580acd222be65307c398748bdb869015233f
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-10-17 19:02:41 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-10-17 19:02:41 +0000

    sysutils/agedu: Fix infinite loop in round_and_format_age
    
    - Bump PORTREVISION for package change
    
    Obtained from:  https://git.tartarus.org/?p=simon/agedu.git;a=commit;h=3622edabe7f6776dc66dd5d685ab9980226cfa6b
---
 sysutils/agedu/Makefile           |  1 +
 sysutils/agedu/files/patch-html.c | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/sysutils/agedu/Makefile b/sysutils/agedu/Makefile
index 349c017fdd38..9e7d4b002813 100644
--- a/sysutils/agedu/Makefile
+++ b/sysutils/agedu/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	agedu
 PORTVERSION=	20211129.8cd63c5
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	https://www.chiark.greenend.org.uk/~sgtatham/agedu/ \
 		LOCAL/sunpoet
diff --git a/sysutils/agedu/files/patch-html.c b/sysutils/agedu/files/patch-html.c
new file mode 100644
index 000000000000..8e6b4f107c1d
--- /dev/null
+++ b/sysutils/agedu/files/patch-html.c
@@ -0,0 +1,13 @@
+Obtained from:	https://git.tartarus.org/?p=simon/agedu.git;a=commit;h=3622edabe7f6776dc66dd5d685ab9980226cfa6b
+
+--- html.c.orig	2021-11-29 02:20:04 UTC
++++ html.c
+@@ -131,6 +131,8 @@ static unsigned long long round_and_format_age(struct 
+ 	sprintf(newbuf, "%d year%s", i, i==1 ? "" : "s");
+ 	if (newret < age)
+ 	    goto finish;
++	if (newret > ret)              /* integer overflow - give up! */
++	    goto finish;
+ 	strcpy(buf, newbuf);
+ 	ret = newret;
+     }