summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2004-06-11 23:08:57 +0000
committerCy Schubert <cy@FreeBSD.org>2004-06-11 23:08:57 +0000
commit80b9496636f9ff16ebc3717429821c4cbac4e770 (patch)
treeefdb7eccc1ad4ce572b6a7b4194cc923dd30777f /security
parentUse gnometarget. (diff)
Update KRB5 1.3.3 --> 1.3.4
Notes
Notes: svn path=/head/; revision=111315
Diffstat (limited to 'security')
-rw-r--r--security/krb5-16/Makefile3
-rw-r--r--security/krb5-16/distinfo4
-rw-r--r--security/krb5-16/files/patch-lib::krb5::os::an_to_ln.c165
-rw-r--r--security/krb5-17/Makefile3
-rw-r--r--security/krb5-17/distinfo4
-rw-r--r--security/krb5-17/files/patch-lib::krb5::os::an_to_ln.c165
-rw-r--r--security/krb5-appl/Makefile3
-rw-r--r--security/krb5-appl/distinfo4
-rw-r--r--security/krb5-appl/files/patch-lib::krb5::os::an_to_ln.c165
-rw-r--r--security/krb5/Makefile3
-rw-r--r--security/krb5/distinfo4
-rw-r--r--security/krb5/files/patch-lib::krb5::os::an_to_ln.c165
12 files changed, 12 insertions, 676 deletions
diff --git a/security/krb5-16/Makefile b/security/krb5-16/Makefile
index 1a755930edd8..9c3dd3045662 100644
--- a/security/krb5-16/Makefile
+++ b/security/krb5-16/Makefile
@@ -6,8 +6,7 @@
#
PORTNAME= krb5
-PORTVERSION= 1.3.3
-PORTREVISION= 2
+PORTVERSION= 1.3.4
CATEGORIES= security
# USE_TARBALL tells the port that the user has fetched the source
# directly from MIT or crypto-publish.org (CRYTPO-PUBLISH).
diff --git a/security/krb5-16/distinfo b/security/krb5-16/distinfo
index a1d1c2ea8228..48b18a657c5d 100644
--- a/security/krb5-16/distinfo
+++ b/security/krb5-16/distinfo
@@ -1,4 +1,4 @@
-MD5 (krb5-1.3.3.tar) = 9c872750fce0f4ff64e0325e278ce882
-SIZE (krb5-1.3.3.tar) = 6359040
+MD5 (krb5-1.3.4.tar) = 33fdee0c5e78f67a18a781dee31e3e19
+SIZE (krb5-1.3.4.tar) = 6369280
MD5 (krb5-1.3.1.tar.gz) = 73f868cf65bec56d7c718834ca5665fd
SIZE (krb5-1.3.1.tar.gz) = 6157946
diff --git a/security/krb5-16/files/patch-lib::krb5::os::an_to_ln.c b/security/krb5-16/files/patch-lib::krb5::os::an_to_ln.c
deleted file mode 100644
index 20b39752093f..000000000000
--- a/security/krb5-16/files/patch-lib::krb5::os::an_to_ln.c
+++ /dev/null
@@ -1,165 +0,0 @@
---- lib/krb5/os/an_to_ln.c.orig Tue Sep 3 12:29:34 2002
-+++ lib/krb5/os/an_to_ln.c Fri Jun 4 09:19:24 2004
-@@ -270,9 +270,14 @@
- * If no regcomp() then just return the input string verbatim in the output
- * string.
- */
--static void
-+#define use_bytes(x) \
-+ out_used += (x); \
-+ if (out_used > MAX_FORMAT_BUFFER) goto mem_err
-+
-+static int
- do_replacement(char *regexp, char *repl, int doall, char *in, char *out)
- {
-+ size_t out_used = 0;
- #if HAVE_REGCOMP
- regex_t match_exp;
- regmatch_t match_match;
-@@ -287,17 +292,22 @@
- do {
- if (!regexec(&match_exp, cp, 1, &match_match, 0)) {
- if (match_match.rm_so) {
-+ use_bytes(match_match.rm_so);
- strncpy(op, cp, match_match.rm_so);
- op += match_match.rm_so;
- }
-+ use_bytes(strlen(repl));
- strncpy(op, repl, MAX_FORMAT_BUFFER - 1 - (op - out));
- op += strlen(op);
- cp += match_match.rm_eo;
-- if (!doall)
-+ if (!doall) {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
-+ }
- matched = 1;
- }
- else {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
- matched = 0;
- }
-@@ -322,17 +332,22 @@
- sdispl = (size_t) (loc1 - cp);
- edispl = (size_t) (loc2 - cp);
- if (sdispl) {
-+ use_bytes(sdispl);
- strncpy(op, cp, sdispl);
- op += sdispl;
- }
-+ use_bytes(strlen(repl));
- strncpy(op, repl, MAX_FORMAT_BUFFER - 1 - (op - out));
- op += strlen(repl);
- cp += edispl;
-- if (!doall)
-+ if (!doall) {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
-+ }
- matched = 1;
- }
- else {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
- matched = 0;
- }
-@@ -340,7 +355,15 @@
- #else /* HAVE_REGEXP_H */
- memcpy(out, in, MAX_FORMAT_BUFFER);
- #endif /* HAVE_REGCOMP */
-+ return 1;
-+ mem_err:
-+#ifdef HAVE_REGCMP
-+ regfree(&match_exp);
-+#endif
-+ return 0;
-+
- }
-+#undef use_bytes
-
- /*
- * aname_replacer() - Perform the specified substitutions on the input
-@@ -412,7 +435,12 @@
-
- /* Do the replacemenbt */
- memset(out, '\0', MAX_FORMAT_BUFFER);
-- do_replacement(rule, repl, doglobal, in, out);
-+ if (!do_replacement(rule, repl, doglobal, in, out)) {
-+ free(rule);
-+ free(repl);
-+ kret = KRB5_LNAME_NOTRANS;
-+ break;
-+ }
- free(rule);
- free(repl);
-
-@@ -459,6 +487,7 @@
- char *fprincname;
- char *selstring = 0;
- int num_comps, compind;
-+ size_t selstring_used;
- char *cout;
- krb5_data *datap;
- char *outstring;
-@@ -479,6 +508,7 @@
- */
- current = strchr(current, ':');
- selstring = (char *) malloc(MAX_FORMAT_BUFFER);
-+ selstring_used = 0;
- if (current && selstring) {
- current++;
- cout = selstring;
-@@ -497,6 +527,14 @@
- aname,
- compind-1))
- ) {
-+ if ((datap->length < MAX_FORMAT_BUFFER)
-+ && (selstring_used+datap->length
-+ < MAX_FORMAT_BUFFER)) {
-+ selstring_used += datap->length;
-+ } else {
-+ kret = ENOMEM;
-+ goto errout;
-+ }
- strncpy(cout,
- datap->data,
- (unsigned) datap->length);
-@@ -527,7 +565,7 @@
- else
- kret = KRB5_CONFIG_BADFORMAT;
-
-- if (kret)
-+ errout: if (kret)
- free(selstring);
- }
- }
-@@ -643,7 +681,7 @@
- const char *hierarchy[5];
- char **mapping_values;
- int i, nvalid;
-- char *cp;
-+ char *cp, *s;
- char *typep, *argp;
- unsigned int lnsize;
-
-@@ -677,11 +715,14 @@
-
- /* Just use the last one. */
- /* Trim the value. */
-- cp = &mapping_values[nvalid-1]
-- [strlen(mapping_values[nvalid-1])];
-- while (isspace((int) (*cp))) cp--;
-- cp++;
-- *cp = '\0';
-+ s = mapping_values[nvalid-1];
-+ cp = s + strlen(s);
-+ while (cp > s) {
-+ cp--;
-+ if (!isspace((int)(*cp)))
-+ break;
-+ *cp = '\0';
-+ }
-
- /* Copy out the value if there's enough room */
- if (strlen(mapping_values[nvalid-1])+1 <= (size_t) lnsize)
diff --git a/security/krb5-17/Makefile b/security/krb5-17/Makefile
index 1a755930edd8..9c3dd3045662 100644
--- a/security/krb5-17/Makefile
+++ b/security/krb5-17/Makefile
@@ -6,8 +6,7 @@
#
PORTNAME= krb5
-PORTVERSION= 1.3.3
-PORTREVISION= 2
+PORTVERSION= 1.3.4
CATEGORIES= security
# USE_TARBALL tells the port that the user has fetched the source
# directly from MIT or crypto-publish.org (CRYTPO-PUBLISH).
diff --git a/security/krb5-17/distinfo b/security/krb5-17/distinfo
index a1d1c2ea8228..48b18a657c5d 100644
--- a/security/krb5-17/distinfo
+++ b/security/krb5-17/distinfo
@@ -1,4 +1,4 @@
-MD5 (krb5-1.3.3.tar) = 9c872750fce0f4ff64e0325e278ce882
-SIZE (krb5-1.3.3.tar) = 6359040
+MD5 (krb5-1.3.4.tar) = 33fdee0c5e78f67a18a781dee31e3e19
+SIZE (krb5-1.3.4.tar) = 6369280
MD5 (krb5-1.3.1.tar.gz) = 73f868cf65bec56d7c718834ca5665fd
SIZE (krb5-1.3.1.tar.gz) = 6157946
diff --git a/security/krb5-17/files/patch-lib::krb5::os::an_to_ln.c b/security/krb5-17/files/patch-lib::krb5::os::an_to_ln.c
deleted file mode 100644
index 20b39752093f..000000000000
--- a/security/krb5-17/files/patch-lib::krb5::os::an_to_ln.c
+++ /dev/null
@@ -1,165 +0,0 @@
---- lib/krb5/os/an_to_ln.c.orig Tue Sep 3 12:29:34 2002
-+++ lib/krb5/os/an_to_ln.c Fri Jun 4 09:19:24 2004
-@@ -270,9 +270,14 @@
- * If no regcomp() then just return the input string verbatim in the output
- * string.
- */
--static void
-+#define use_bytes(x) \
-+ out_used += (x); \
-+ if (out_used > MAX_FORMAT_BUFFER) goto mem_err
-+
-+static int
- do_replacement(char *regexp, char *repl, int doall, char *in, char *out)
- {
-+ size_t out_used = 0;
- #if HAVE_REGCOMP
- regex_t match_exp;
- regmatch_t match_match;
-@@ -287,17 +292,22 @@
- do {
- if (!regexec(&match_exp, cp, 1, &match_match, 0)) {
- if (match_match.rm_so) {
-+ use_bytes(match_match.rm_so);
- strncpy(op, cp, match_match.rm_so);
- op += match_match.rm_so;
- }
-+ use_bytes(strlen(repl));
- strncpy(op, repl, MAX_FORMAT_BUFFER - 1 - (op - out));
- op += strlen(op);
- cp += match_match.rm_eo;
-- if (!doall)
-+ if (!doall) {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
-+ }
- matched = 1;
- }
- else {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
- matched = 0;
- }
-@@ -322,17 +332,22 @@
- sdispl = (size_t) (loc1 - cp);
- edispl = (size_t) (loc2 - cp);
- if (sdispl) {
-+ use_bytes(sdispl);
- strncpy(op, cp, sdispl);
- op += sdispl;
- }
-+ use_bytes(strlen(repl));
- strncpy(op, repl, MAX_FORMAT_BUFFER - 1 - (op - out));
- op += strlen(repl);
- cp += edispl;
-- if (!doall)
-+ if (!doall) {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
-+ }
- matched = 1;
- }
- else {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
- matched = 0;
- }
-@@ -340,7 +355,15 @@
- #else /* HAVE_REGEXP_H */
- memcpy(out, in, MAX_FORMAT_BUFFER);
- #endif /* HAVE_REGCOMP */
-+ return 1;
-+ mem_err:
-+#ifdef HAVE_REGCMP
-+ regfree(&match_exp);
-+#endif
-+ return 0;
-+
- }
-+#undef use_bytes
-
- /*
- * aname_replacer() - Perform the specified substitutions on the input
-@@ -412,7 +435,12 @@
-
- /* Do the replacemenbt */
- memset(out, '\0', MAX_FORMAT_BUFFER);
-- do_replacement(rule, repl, doglobal, in, out);
-+ if (!do_replacement(rule, repl, doglobal, in, out)) {
-+ free(rule);
-+ free(repl);
-+ kret = KRB5_LNAME_NOTRANS;
-+ break;
-+ }
- free(rule);
- free(repl);
-
-@@ -459,6 +487,7 @@
- char *fprincname;
- char *selstring = 0;
- int num_comps, compind;
-+ size_t selstring_used;
- char *cout;
- krb5_data *datap;
- char *outstring;
-@@ -479,6 +508,7 @@
- */
- current = strchr(current, ':');
- selstring = (char *) malloc(MAX_FORMAT_BUFFER);
-+ selstring_used = 0;
- if (current && selstring) {
- current++;
- cout = selstring;
-@@ -497,6 +527,14 @@
- aname,
- compind-1))
- ) {
-+ if ((datap->length < MAX_FORMAT_BUFFER)
-+ && (selstring_used+datap->length
-+ < MAX_FORMAT_BUFFER)) {
-+ selstring_used += datap->length;
-+ } else {
-+ kret = ENOMEM;
-+ goto errout;
-+ }
- strncpy(cout,
- datap->data,
- (unsigned) datap->length);
-@@ -527,7 +565,7 @@
- else
- kret = KRB5_CONFIG_BADFORMAT;
-
-- if (kret)
-+ errout: if (kret)
- free(selstring);
- }
- }
-@@ -643,7 +681,7 @@
- const char *hierarchy[5];
- char **mapping_values;
- int i, nvalid;
-- char *cp;
-+ char *cp, *s;
- char *typep, *argp;
- unsigned int lnsize;
-
-@@ -677,11 +715,14 @@
-
- /* Just use the last one. */
- /* Trim the value. */
-- cp = &mapping_values[nvalid-1]
-- [strlen(mapping_values[nvalid-1])];
-- while (isspace((int) (*cp))) cp--;
-- cp++;
-- *cp = '\0';
-+ s = mapping_values[nvalid-1];
-+ cp = s + strlen(s);
-+ while (cp > s) {
-+ cp--;
-+ if (!isspace((int)(*cp)))
-+ break;
-+ *cp = '\0';
-+ }
-
- /* Copy out the value if there's enough room */
- if (strlen(mapping_values[nvalid-1])+1 <= (size_t) lnsize)
diff --git a/security/krb5-appl/Makefile b/security/krb5-appl/Makefile
index 1a755930edd8..9c3dd3045662 100644
--- a/security/krb5-appl/Makefile
+++ b/security/krb5-appl/Makefile
@@ -6,8 +6,7 @@
#
PORTNAME= krb5
-PORTVERSION= 1.3.3
-PORTREVISION= 2
+PORTVERSION= 1.3.4
CATEGORIES= security
# USE_TARBALL tells the port that the user has fetched the source
# directly from MIT or crypto-publish.org (CRYTPO-PUBLISH).
diff --git a/security/krb5-appl/distinfo b/security/krb5-appl/distinfo
index a1d1c2ea8228..48b18a657c5d 100644
--- a/security/krb5-appl/distinfo
+++ b/security/krb5-appl/distinfo
@@ -1,4 +1,4 @@
-MD5 (krb5-1.3.3.tar) = 9c872750fce0f4ff64e0325e278ce882
-SIZE (krb5-1.3.3.tar) = 6359040
+MD5 (krb5-1.3.4.tar) = 33fdee0c5e78f67a18a781dee31e3e19
+SIZE (krb5-1.3.4.tar) = 6369280
MD5 (krb5-1.3.1.tar.gz) = 73f868cf65bec56d7c718834ca5665fd
SIZE (krb5-1.3.1.tar.gz) = 6157946
diff --git a/security/krb5-appl/files/patch-lib::krb5::os::an_to_ln.c b/security/krb5-appl/files/patch-lib::krb5::os::an_to_ln.c
deleted file mode 100644
index 20b39752093f..000000000000
--- a/security/krb5-appl/files/patch-lib::krb5::os::an_to_ln.c
+++ /dev/null
@@ -1,165 +0,0 @@
---- lib/krb5/os/an_to_ln.c.orig Tue Sep 3 12:29:34 2002
-+++ lib/krb5/os/an_to_ln.c Fri Jun 4 09:19:24 2004
-@@ -270,9 +270,14 @@
- * If no regcomp() then just return the input string verbatim in the output
- * string.
- */
--static void
-+#define use_bytes(x) \
-+ out_used += (x); \
-+ if (out_used > MAX_FORMAT_BUFFER) goto mem_err
-+
-+static int
- do_replacement(char *regexp, char *repl, int doall, char *in, char *out)
- {
-+ size_t out_used = 0;
- #if HAVE_REGCOMP
- regex_t match_exp;
- regmatch_t match_match;
-@@ -287,17 +292,22 @@
- do {
- if (!regexec(&match_exp, cp, 1, &match_match, 0)) {
- if (match_match.rm_so) {
-+ use_bytes(match_match.rm_so);
- strncpy(op, cp, match_match.rm_so);
- op += match_match.rm_so;
- }
-+ use_bytes(strlen(repl));
- strncpy(op, repl, MAX_FORMAT_BUFFER - 1 - (op - out));
- op += strlen(op);
- cp += match_match.rm_eo;
-- if (!doall)
-+ if (!doall) {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
-+ }
- matched = 1;
- }
- else {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
- matched = 0;
- }
-@@ -322,17 +332,22 @@
- sdispl = (size_t) (loc1 - cp);
- edispl = (size_t) (loc2 - cp);
- if (sdispl) {
-+ use_bytes(sdispl);
- strncpy(op, cp, sdispl);
- op += sdispl;
- }
-+ use_bytes(strlen(repl));
- strncpy(op, repl, MAX_FORMAT_BUFFER - 1 - (op - out));
- op += strlen(repl);
- cp += edispl;
-- if (!doall)
-+ if (!doall) {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
-+ }
- matched = 1;
- }
- else {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
- matched = 0;
- }
-@@ -340,7 +355,15 @@
- #else /* HAVE_REGEXP_H */
- memcpy(out, in, MAX_FORMAT_BUFFER);
- #endif /* HAVE_REGCOMP */
-+ return 1;
-+ mem_err:
-+#ifdef HAVE_REGCMP
-+ regfree(&match_exp);
-+#endif
-+ return 0;
-+
- }
-+#undef use_bytes
-
- /*
- * aname_replacer() - Perform the specified substitutions on the input
-@@ -412,7 +435,12 @@
-
- /* Do the replacemenbt */
- memset(out, '\0', MAX_FORMAT_BUFFER);
-- do_replacement(rule, repl, doglobal, in, out);
-+ if (!do_replacement(rule, repl, doglobal, in, out)) {
-+ free(rule);
-+ free(repl);
-+ kret = KRB5_LNAME_NOTRANS;
-+ break;
-+ }
- free(rule);
- free(repl);
-
-@@ -459,6 +487,7 @@
- char *fprincname;
- char *selstring = 0;
- int num_comps, compind;
-+ size_t selstring_used;
- char *cout;
- krb5_data *datap;
- char *outstring;
-@@ -479,6 +508,7 @@
- */
- current = strchr(current, ':');
- selstring = (char *) malloc(MAX_FORMAT_BUFFER);
-+ selstring_used = 0;
- if (current && selstring) {
- current++;
- cout = selstring;
-@@ -497,6 +527,14 @@
- aname,
- compind-1))
- ) {
-+ if ((datap->length < MAX_FORMAT_BUFFER)
-+ && (selstring_used+datap->length
-+ < MAX_FORMAT_BUFFER)) {
-+ selstring_used += datap->length;
-+ } else {
-+ kret = ENOMEM;
-+ goto errout;
-+ }
- strncpy(cout,
- datap->data,
- (unsigned) datap->length);
-@@ -527,7 +565,7 @@
- else
- kret = KRB5_CONFIG_BADFORMAT;
-
-- if (kret)
-+ errout: if (kret)
- free(selstring);
- }
- }
-@@ -643,7 +681,7 @@
- const char *hierarchy[5];
- char **mapping_values;
- int i, nvalid;
-- char *cp;
-+ char *cp, *s;
- char *typep, *argp;
- unsigned int lnsize;
-
-@@ -677,11 +715,14 @@
-
- /* Just use the last one. */
- /* Trim the value. */
-- cp = &mapping_values[nvalid-1]
-- [strlen(mapping_values[nvalid-1])];
-- while (isspace((int) (*cp))) cp--;
-- cp++;
-- *cp = '\0';
-+ s = mapping_values[nvalid-1];
-+ cp = s + strlen(s);
-+ while (cp > s) {
-+ cp--;
-+ if (!isspace((int)(*cp)))
-+ break;
-+ *cp = '\0';
-+ }
-
- /* Copy out the value if there's enough room */
- if (strlen(mapping_values[nvalid-1])+1 <= (size_t) lnsize)
diff --git a/security/krb5/Makefile b/security/krb5/Makefile
index 1a755930edd8..9c3dd3045662 100644
--- a/security/krb5/Makefile
+++ b/security/krb5/Makefile
@@ -6,8 +6,7 @@
#
PORTNAME= krb5
-PORTVERSION= 1.3.3
-PORTREVISION= 2
+PORTVERSION= 1.3.4
CATEGORIES= security
# USE_TARBALL tells the port that the user has fetched the source
# directly from MIT or crypto-publish.org (CRYTPO-PUBLISH).
diff --git a/security/krb5/distinfo b/security/krb5/distinfo
index a1d1c2ea8228..48b18a657c5d 100644
--- a/security/krb5/distinfo
+++ b/security/krb5/distinfo
@@ -1,4 +1,4 @@
-MD5 (krb5-1.3.3.tar) = 9c872750fce0f4ff64e0325e278ce882
-SIZE (krb5-1.3.3.tar) = 6359040
+MD5 (krb5-1.3.4.tar) = 33fdee0c5e78f67a18a781dee31e3e19
+SIZE (krb5-1.3.4.tar) = 6369280
MD5 (krb5-1.3.1.tar.gz) = 73f868cf65bec56d7c718834ca5665fd
SIZE (krb5-1.3.1.tar.gz) = 6157946
diff --git a/security/krb5/files/patch-lib::krb5::os::an_to_ln.c b/security/krb5/files/patch-lib::krb5::os::an_to_ln.c
deleted file mode 100644
index 20b39752093f..000000000000
--- a/security/krb5/files/patch-lib::krb5::os::an_to_ln.c
+++ /dev/null
@@ -1,165 +0,0 @@
---- lib/krb5/os/an_to_ln.c.orig Tue Sep 3 12:29:34 2002
-+++ lib/krb5/os/an_to_ln.c Fri Jun 4 09:19:24 2004
-@@ -270,9 +270,14 @@
- * If no regcomp() then just return the input string verbatim in the output
- * string.
- */
--static void
-+#define use_bytes(x) \
-+ out_used += (x); \
-+ if (out_used > MAX_FORMAT_BUFFER) goto mem_err
-+
-+static int
- do_replacement(char *regexp, char *repl, int doall, char *in, char *out)
- {
-+ size_t out_used = 0;
- #if HAVE_REGCOMP
- regex_t match_exp;
- regmatch_t match_match;
-@@ -287,17 +292,22 @@
- do {
- if (!regexec(&match_exp, cp, 1, &match_match, 0)) {
- if (match_match.rm_so) {
-+ use_bytes(match_match.rm_so);
- strncpy(op, cp, match_match.rm_so);
- op += match_match.rm_so;
- }
-+ use_bytes(strlen(repl));
- strncpy(op, repl, MAX_FORMAT_BUFFER - 1 - (op - out));
- op += strlen(op);
- cp += match_match.rm_eo;
-- if (!doall)
-+ if (!doall) {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
-+ }
- matched = 1;
- }
- else {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
- matched = 0;
- }
-@@ -322,17 +332,22 @@
- sdispl = (size_t) (loc1 - cp);
- edispl = (size_t) (loc2 - cp);
- if (sdispl) {
-+ use_bytes(sdispl);
- strncpy(op, cp, sdispl);
- op += sdispl;
- }
-+ use_bytes(strlen(repl));
- strncpy(op, repl, MAX_FORMAT_BUFFER - 1 - (op - out));
- op += strlen(repl);
- cp += edispl;
-- if (!doall)
-+ if (!doall) {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
-+ }
- matched = 1;
- }
- else {
-+ use_bytes(strlen(cp));
- strncpy(op, cp, MAX_FORMAT_BUFFER - 1 - (op - out));
- matched = 0;
- }
-@@ -340,7 +355,15 @@
- #else /* HAVE_REGEXP_H */
- memcpy(out, in, MAX_FORMAT_BUFFER);
- #endif /* HAVE_REGCOMP */
-+ return 1;
-+ mem_err:
-+#ifdef HAVE_REGCMP
-+ regfree(&match_exp);
-+#endif
-+ return 0;
-+
- }
-+#undef use_bytes
-
- /*
- * aname_replacer() - Perform the specified substitutions on the input
-@@ -412,7 +435,12 @@
-
- /* Do the replacemenbt */
- memset(out, '\0', MAX_FORMAT_BUFFER);
-- do_replacement(rule, repl, doglobal, in, out);
-+ if (!do_replacement(rule, repl, doglobal, in, out)) {
-+ free(rule);
-+ free(repl);
-+ kret = KRB5_LNAME_NOTRANS;
-+ break;
-+ }
- free(rule);
- free(repl);
-
-@@ -459,6 +487,7 @@
- char *fprincname;
- char *selstring = 0;
- int num_comps, compind;
-+ size_t selstring_used;
- char *cout;
- krb5_data *datap;
- char *outstring;
-@@ -479,6 +508,7 @@
- */
- current = strchr(current, ':');
- selstring = (char *) malloc(MAX_FORMAT_BUFFER);
-+ selstring_used = 0;
- if (current && selstring) {
- current++;
- cout = selstring;
-@@ -497,6 +527,14 @@
- aname,
- compind-1))
- ) {
-+ if ((datap->length < MAX_FORMAT_BUFFER)
-+ && (selstring_used+datap->length
-+ < MAX_FORMAT_BUFFER)) {
-+ selstring_used += datap->length;
-+ } else {
-+ kret = ENOMEM;
-+ goto errout;
-+ }
- strncpy(cout,
- datap->data,
- (unsigned) datap->length);
-@@ -527,7 +565,7 @@
- else
- kret = KRB5_CONFIG_BADFORMAT;
-
-- if (kret)
-+ errout: if (kret)
- free(selstring);
- }
- }
-@@ -643,7 +681,7 @@
- const char *hierarchy[5];
- char **mapping_values;
- int i, nvalid;
-- char *cp;
-+ char *cp, *s;
- char *typep, *argp;
- unsigned int lnsize;
-
-@@ -677,11 +715,14 @@
-
- /* Just use the last one. */
- /* Trim the value. */
-- cp = &mapping_values[nvalid-1]
-- [strlen(mapping_values[nvalid-1])];
-- while (isspace((int) (*cp))) cp--;
-- cp++;
-- *cp = '\0';
-+ s = mapping_values[nvalid-1];
-+ cp = s + strlen(s);
-+ while (cp > s) {
-+ cp--;
-+ if (!isspace((int)(*cp)))
-+ break;
-+ *cp = '\0';
-+ }
-
- /* Copy out the value if there's enough room */
- if (strlen(mapping_values[nvalid-1])+1 <= (size_t) lnsize)