From b53f2958fef06605ab6547a7921008a5d0d78f84 Mon Sep 17 00:00:00 2001 From: Adam Weinberger Date: Wed, 1 Sep 2004 01:40:34 +0000 Subject: The recently comitted BPM port fails to handle the new INDEX file format, which has had several fields added to it. In addition, it reacts badly when parse errors occur on the INDEX file, resulting in double free()s. The patch works around both of these problems until the next formal release. PR: ports/71213 Submitted by: maintainer --- ports-mgmt/bpm/Makefile | 1 + ports-mgmt/bpm/files/patch-src::refresh.c | 23 +++++++++++++++++++++++ sysutils/bpm/Makefile | 1 + sysutils/bpm/files/patch-src::refresh.c | 23 +++++++++++++++++++++++ 4 files changed, 48 insertions(+) diff --git a/ports-mgmt/bpm/Makefile b/ports-mgmt/bpm/Makefile index b1166e268c1c..49448c85e5f0 100644 --- a/ports-mgmt/bpm/Makefile +++ b/ports-mgmt/bpm/Makefile @@ -7,6 +7,7 @@ PORTNAME= bpm PORTVERSION= 0.4.1b +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= http://www.meowfishies.com/code/bpm/ EXTRACT_SUFX= .tgz diff --git a/ports-mgmt/bpm/files/patch-src::refresh.c b/ports-mgmt/bpm/files/patch-src::refresh.c index b96fa00ecd8d..03b9c059749b 100644 --- a/ports-mgmt/bpm/files/patch-src::refresh.c +++ b/ports-mgmt/bpm/files/patch-src::refresh.c @@ -12,3 +12,26 @@ #define INDEX_MAXLN 4096 #define DB_DIR "/var/db/pkg" #define ITER_BYTES (128 * 1024) +@@ -183,10 +187,12 @@ + if (*sp == '|') + ++i; + +- if (i != (PFIELD_NFIELD - 1)) ++ if (i < (PFIELD_NFIELD - 1)) + { + #ifdef DEBUG +- warnx("invalid number of fields"); ++ warnx("invalid number of fields (%d should be %d)", ++ i + 1, ++ PFIELD_NFIELD); + #endif /* DEBUG */ + return FALSE; + } +@@ -320,7 +326,6 @@ + + if (_refresh_index_parse(ln, portdp, rdp) != TRUE) + { +- _refresh_portfree(portdp); + #ifdef DEBUG + warnx("%s:%u: invalid format", INDEX_FN, rdp->rd_linec); + #endif /* DEBUG */ diff --git a/sysutils/bpm/Makefile b/sysutils/bpm/Makefile index b1166e268c1c..49448c85e5f0 100644 --- a/sysutils/bpm/Makefile +++ b/sysutils/bpm/Makefile @@ -7,6 +7,7 @@ PORTNAME= bpm PORTVERSION= 0.4.1b +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= http://www.meowfishies.com/code/bpm/ EXTRACT_SUFX= .tgz diff --git a/sysutils/bpm/files/patch-src::refresh.c b/sysutils/bpm/files/patch-src::refresh.c index b96fa00ecd8d..03b9c059749b 100644 --- a/sysutils/bpm/files/patch-src::refresh.c +++ b/sysutils/bpm/files/patch-src::refresh.c @@ -12,3 +12,26 @@ #define INDEX_MAXLN 4096 #define DB_DIR "/var/db/pkg" #define ITER_BYTES (128 * 1024) +@@ -183,10 +187,12 @@ + if (*sp == '|') + ++i; + +- if (i != (PFIELD_NFIELD - 1)) ++ if (i < (PFIELD_NFIELD - 1)) + { + #ifdef DEBUG +- warnx("invalid number of fields"); ++ warnx("invalid number of fields (%d should be %d)", ++ i + 1, ++ PFIELD_NFIELD); + #endif /* DEBUG */ + return FALSE; + } +@@ -320,7 +326,6 @@ + + if (_refresh_index_parse(ln, portdp, rdp) != TRUE) + { +- _refresh_portfree(portdp); + #ifdef DEBUG + warnx("%s:%u: invalid format", INDEX_FN, rdp->rd_linec); + #endif /* DEBUG */ -- cgit v1.2.3