projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
733d1ea
)
fix one-byte overflow in legacy getpass function
author
Rich Felker
<dalias@aerifal.cx>
Tue, 14 Mar 2017 19:13:16 +0000
(15:13 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Tue, 14 Mar 2017 19:13:16 +0000
(15:13 -0400)
if the length of the input was equal to the buffer size (128), a fixed
value of zero was written one byte past the end of the static buffer.
src/legacy/getpass.c
patch
|
blob
|
history
diff --git
a/src/legacy/getpass.c
b/src/legacy/getpass.c
index 15ab9851e8f886d52187cf8910619b08f63cb5bc..d51286c0b03b3b3e9109a1e20804dbb9d4f3c4a1 100644
(file)
--- a/
src/legacy/getpass.c
+++ b/
src/legacy/getpass.c
@@
-27,7
+27,7
@@
char *getpass(const char *prompt)
l = read(fd, password, sizeof password);
if (l >= 0) {
- if (l > 0 && password[l-1] == '\n') l--;
+ if (l > 0 && password[l-1] == '\n'
|| l==sizeof password
) l--;
password[l] = 0;
}