aboutsummaryrefslogtreecommitdiff
path: root/libpam_misc
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-07-02 08:00:00 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-07-02 08:00:00 +0000
commit22a8e3c307830c728d01b21d91a581ab8efe8155 (patch)
treec0b7aaaaf7e47a0d1b7da1b8eb3914dcc024249a /libpam_misc
parent276ad5b8e48aa77c24ef25e18d2e97f66c83d68c (diff)
downloadpam-22a8e3c307830c728d01b21d91a581ab8efe8155.tar.gz
pam-22a8e3c307830c728d01b21d91a581ab8efe8155.tar.bz2
pam-22a8e3c307830c728d01b21d91a581ab8efe8155.zip
misc_conv: fix potential information leak on error path
* libpam_misc/misc_conv.c (read_string): Clear the stack buffer from data read earlier from stdin in case of a read error.
Diffstat (limited to 'libpam_misc')
-rw-r--r--libpam_misc/misc_conv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libpam_misc/misc_conv.c b/libpam_misc/misc_conv.c
index 70b96454..35610e05 100644
--- a/libpam_misc/misc_conv.c
+++ b/libpam_misc/misc_conv.c
@@ -184,8 +184,10 @@ static int read_string(int echo, const char *prompt, char **retstr)
nc++) {
int rv;
if ((rv=read(STDIN_FILENO, line+nc, 1)) != 1) {
- if (rv < 0)
+ if (rv < 0) {
+ _pam_overwrite_n(line, (unsigned int) nc);
nc = rv;
+ }
break;
}
}