FreeBSD Bugzilla – Attachment 216225 Details for
Bug 247529
devel/popt: Update to 1.18 and add test target
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Additional patch for popt 1.18 v2
0001-popt118v2.patch (text/plain), 3.69 KB, created by
Daniel Engberg
on 2020-07-05 18:39:35 UTC
(
hide
)
Description:
Additional patch for popt 1.18 v2
Filename:
MIME Type:
Creator:
Daniel Engberg
Created:
2020-07-05 18:39:35 UTC
Size:
3.69 KB
patch
obsolete
>From a7cfa6ec77599b05bcf8ee1e6d16f2c01ef81acc Mon Sep 17 00:00:00 2001 >From: Daniel Engberg <daniel.engberg.lists@pyret.net> >Date: Sun, 5 Jul 2020 12:14:03 +0200 >Subject: [PATCH] popt118v2 > >popt118v2 > >Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net> >--- > devel/popt/Makefile | 3 +- > devel/popt/files/patch-src_popt.c | 55 ++++++++++++++++++++++++++++ > devel/popt/files/patch-src_poptint.h | 10 +++++ > 3 files changed, 67 insertions(+), 1 deletion(-) > create mode 100644 devel/popt/files/patch-src_popt.c > create mode 100644 devel/popt/files/patch-src_poptint.h > >diff --git a/devel/popt/Makefile b/devel/popt/Makefile >index c718b92f4170..87be44c9bd7e 100644 >--- a/devel/popt/Makefile >+++ b/devel/popt/Makefile >@@ -3,6 +3,7 @@ > > PORTNAME= popt > PORTVERSION= 1.18 >+PORTREVISION= 1 > CATEGORIES= devel > MASTER_SITES= http://ftp.rpm.org/popt/releases/popt-1.x/ > >@@ -23,7 +24,7 @@ INSTALL_TARGET= install-strip > USE_LDCONFIG= yes > > NLS_CONFIGURE_ENABLE= nls >-NLS_USES= gettext >+NLS_USES= gettext-runtime localbase > OPTIONS_SUB= yes > > .include <bsd.port.mk> >diff --git a/devel/popt/files/patch-src_popt.c b/devel/popt/files/patch-src_popt.c >new file mode 100644 >index 000000000000..2b679be9a987 >--- /dev/null >+++ b/devel/popt/files/patch-src_popt.c >@@ -0,0 +1,55 @@ >+--- src/popt.c.orig 2020-05-18 07:43:13 UTC >++++ src/popt.c >+@@ -168,6 +168,7 @@ poptContext poptGetContext(const char * name, int argc >+ con->os->next = 1; /* skip argv[0] */ >+ >+ con->leftovers = calloc( (size_t)(argc + 1), sizeof(*con->leftovers) ); >++ con->allocLeftovers = argc + 1; >+ con->options = options; >+ con->aliases = NULL; >+ con->numAliases = 0; >+@@ -1269,8 +1270,21 @@ int poptGetNextOpt(poptContext con) >+ con->os->nextArg = xstrdup(origOptString); >+ return 0; >+ } >+- if (con->leftovers != NULL) /* XXX can't happen */ >+- con->leftovers[con->numLeftovers++] = origOptString; >++ if (con->leftovers != NULL) { /* XXX can't happen */ >++ /* One might think we can never overflow the leftovers >++ array. Actually, that's true, as long as you don't >++ use poptStuffArgs()... */ >++ if ((con->numLeftovers + 1) >= (con->allocLeftovers)) { >++ con->allocLeftovers += 10; >++ con->leftovers = >++ realloc(con->leftovers, >++ sizeof(*con->leftovers) * con->allocLeftovers); >++ } >++ con->leftovers[con->numLeftovers++] >++ = xstrdup(origOptString); /* so a free of a stuffed >++ argv doesn't give us a >++ dangling pointer */ >++ } >+ continue; >+ } >+ >+@@ -1519,6 +1533,8 @@ poptItem poptFreeItems(poptItem items, int nitems) >+ >+ poptContext poptFreeContext(poptContext con) >+ { >++ int i; >++ >+ if (con == NULL) return con; >+ poptResetContext(con); >+ >+@@ -1528,7 +1544,11 @@ poptContext poptFreeContext(poptContext con) >+ con->execs = poptFreeItems(con->execs, con->numExecs); >+ con->numExecs = 0; >+ >++ for (i = 0; i < con->numLeftovers; i++) { >++ con->leftovers[i] = _free(&con->leftovers[i]); >++ } >+ con->leftovers = _free(con->leftovers); >++ >+ con->finalArgv = _free(con->finalArgv); >+ con->appName = _free(con->appName); >+ con->otherHelp = _free(con->otherHelp); >diff --git a/devel/popt/files/patch-src_poptint.h b/devel/popt/files/patch-src_poptint.h >new file mode 100644 >index 000000000000..5d3cd38c8159 >--- /dev/null >+++ b/devel/popt/files/patch-src_poptint.h >@@ -0,0 +1,10 @@ >+--- src/poptint.h.orig 2020-05-18 07:43:13 UTC >++++ src/poptint.h >+@@ -94,6 +94,7 @@ struct poptContext_s { >+ struct optionStackEntry * os; >+ poptArgv leftovers; >+ int numLeftovers; >++ int allocLeftovers; >+ int nextLeftover; >+ const struct poptOption * options; >+ int restLeftover; >-- >2.27.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 247529
:
215918
|
216212
| 216225