summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorValentin Lefebvre <valentin.lefebvre@suse.com>2022-12-01 15:39:22 +0100
committerDmitry V. Levin <ldv@altlinux.org>2022-12-01 08:00:00 +0000
commitb6632fffb324d93de10e3539d39103d1fecf292a (patch)
treee54572062d609dfff742a6bb9d9f8d4396794318 /modules
parenta1f042495c7a23d62103a14aff07c12f49bde739 (diff)
pam_env: _parse_line: fix quoteflg handled
Check if quote flag is positive before decrementing it. Otherwise, for some use case, it could become negative, and have an unwanted empty string instead of an undefined variable. Signed-off-by: Valentin Lefebvre <valentin.lefebvre@suse.com>
Diffstat (limited to 'modules')
-rw-r--r--modules/pam_env/pam_env.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/pam_env/pam_env.c b/modules/pam_env/pam_env.c
index 66fbe240..64a58645 100644
--- a/modules/pam_env/pam_env.c
+++ b/modules/pam_env/pam_env.c
@@ -293,7 +293,8 @@ _parse_line(const pam_handle_t *pamh, const char *buffer, VAR *var)
}
(void)strncpy(*valptr,ptr,length);
(*valptr)[length]='\0';
- } else if (quoteflg--) {
+ } else if (quoteflg) {
+ quoteflg--;
*valptr = &quote; /* a quick hack to handle the empty string */
}
ptr = tmpptr; /* Start the search where we stopped */