Commit 7026b607 authored by Nick Mathewson's avatar Nick Mathewson 🎨
Browse files

Fix spurious compiler warning in do_getpass().

Some compilers apparently noticed that p2len was allowed to be equal
to msg, and so maybe we would be doing memset(prompt2, ' ', 0), and
decided that we probably meant to do memset(prompt2, 0, 0x20);

Stupid compilers, doing optimization before this kind of warning!

My fix is to just fill the entire prompt2 buffer with spaces,
because it's harmless.

Bugfix on e59f0d4c, not in any released Tor.
parent ab78a4df
......@@ -49,7 +49,7 @@ do_getpass(const char *prompt, char *buf, size_t buflen,
if (p2len < sizeof(msg))
p2len = sizeof(msg);
prompt2 = tor_malloc(p2len);
memset(prompt2, ' ', p2len - sizeof(msg));
memset(prompt2, ' ', p2len);
memcpy(prompt2 + p2len - sizeof(msg), msg, sizeof(msg));
buf2 = tor_malloc_zero(buflen);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment