summaryrefslogtreecommitdiffstats
path: root/contrib/openpam
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2012-04-12 11:23:24 +0000
committerdes <des@FreeBSD.org>2012-04-12 11:23:24 +0000
commitc67d18e86934afd3ef175f3eb60c663181ca2d24 (patch)
treebba2a91870f32271c20c86610def51af305813a3 /contrib/openpam
parent319ab382ef5fd326d3fab25c60ffe55702438a37 (diff)
downloadFreeBSD-src-c67d18e86934afd3ef175f3eb60c663181ca2d24.zip
FreeBSD-src-c67d18e86934afd3ef175f3eb60c663181ca2d24.tar.gz
Keep a copy of the original pointer returned by openpam_readline() so
we can free it later, instead of trying to free a pointer that points to the end of the buffer. Committed to head because this code no longer exists upstream. Submitted by: jasone@
Diffstat (limited to 'contrib/openpam')
-rw-r--r--contrib/openpam/lib/openpam_configure.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/contrib/openpam/lib/openpam_configure.c b/contrib/openpam/lib/openpam_configure.c
index edf06c5..66ee5502 100644
--- a/contrib/openpam/lib/openpam_configure.c
+++ b/contrib/openpam/lib/openpam_configure.c
@@ -360,7 +360,7 @@ openpam_parse_chain(pam_handle_t *pamh,
pam_chain_t *this, **next;
pam_facility_t fclt;
pam_control_t ctlf;
- char *line, *str, *name;
+ char *line0, *line, *str, *name;
char *option, **optv;
int len, lineno, ret;
FILE *f;
@@ -377,18 +377,18 @@ openpam_parse_chain(pam_handle_t *pamh,
this = NULL;
name = NULL;
lineno = 0;
- while ((line = openpam_readline(f, &lineno, NULL)) != NULL) {
+ while ((line0 = line = openpam_readline(f, &lineno, NULL)) != NULL) {
/* get service name if necessary */
if (style == pam_conf_style) {
if ((len = parse_service_name(&line, &str)) == 0) {
openpam_log(PAM_LOG_NOTICE,
"%s(%d): invalid service name (ignored)",
filename, lineno);
- FREE(line);
+ FREE(line0);
continue;
}
if (strlcmp(service, str, len) != 0) {
- FREE(line);
+ FREE(line0);
continue;
}
}
@@ -401,7 +401,7 @@ openpam_parse_chain(pam_handle_t *pamh,
goto fail;
}
if (facility != fclt && facility != PAM_FACILITY_ANY) {
- FREE(line);
+ FREE(line0);
continue;
}
@@ -425,7 +425,7 @@ openpam_parse_chain(pam_handle_t *pamh,
FREE(name);
if (ret != PAM_SUCCESS)
goto fail;
- FREE(line);
+ FREE(line0);
continue;
}
@@ -486,7 +486,7 @@ openpam_parse_chain(pam_handle_t *pamh,
this = NULL;
/* next please... */
- FREE(line);
+ FREE(line0);
}
if (!feof(f))
goto syserr;
OpenPOWER on IntegriCloud