aboutsummaryrefslogtreecommitdiff
path: root/contrib/openpam/lib
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2013-03-04 18:51:53 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2013-03-04 18:51:53 +0000
commitea80740663ec3d110656ea6911c7166e6f1e8e17 (patch)
tree0bbbe3b7ce12b5406f91a5a007f7089945373711 /contrib/openpam/lib
parent40e794ab19fb0c33b697878465b9a0936d203d1e (diff)
parent8a441b006240afe43bf29535b9111f19189b02cd (diff)
downloadsrc-ea80740663ec3d110656ea6911c7166e6f1e8e17.tar.gz
src-ea80740663ec3d110656ea6911c7166e6f1e8e17.zip
Merge upstream r634:646: correctly parse mixed quoted / unquoted text.
Notes
Notes: svn path=/head/; revision=247810
Diffstat (limited to 'contrib/openpam/lib')
-rw-r--r--contrib/openpam/lib/openpam_readline.c6
-rw-r--r--contrib/openpam/lib/openpam_readword.c7
2 files changed, 3 insertions, 10 deletions
diff --git a/contrib/openpam/lib/openpam_readline.c b/contrib/openpam/lib/openpam_readline.c
index 014acfb2c1cf..047ab836910a 100644
--- a/contrib/openpam/lib/openpam_readline.c
+++ b/contrib/openpam/lib/openpam_readline.c
@@ -62,11 +62,9 @@ openpam_readline(FILE *f, int *lineno, size_t *lenp)
size_t len, size;
int ch;
- if ((line = malloc(size = MIN_LINE_LENGTH)) == NULL) {
- openpam_log(PAM_LOG_ERROR, "malloc(): %m");
+ line = NULL;
+ if (openpam_straddch(&line, &size, &len, 0) != 0)
return (NULL);
- }
- len = 0;
for (;;) {
ch = fgetc(f);
/* strip comment */
diff --git a/contrib/openpam/lib/openpam_readword.c b/contrib/openpam/lib/openpam_readword.c
index 74a4d462ce44..1c0e9b68149c 100644
--- a/contrib/openpam/lib/openpam_readword.c
+++ b/contrib/openpam/lib/openpam_readword.c
@@ -86,13 +86,8 @@ openpam_readword(FILE *f, int *lineno, size_t *lenp)
/* begin quote */
quote = ch;
/* edge case: empty quoted string */
- if (word == NULL && (word = malloc(1)) == NULL) {
- openpam_log(PAM_LOG_ERROR, "malloc(): %m");
- errno = ENOMEM;
+ if (openpam_straddch(&word, &size, &len, 0) != 0)
return (NULL);
- }
- *word = '\0';
- size = 1;
} else if (ch == quote && !escape) {
/* end quote */
quote = 0;