diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-10-11 09:34:08 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-10-11 09:34:08 -0400 |
commit | 7026b607a0b873ddbee16d5bd8ac2975c7092f5b (patch) | |
tree | 50b7ff96d53472bbe2fa6ac8805452ed5ba30fc4 /src | |
parent | ab78a4df93d1aed26cb13343cdd012c8309a206f (diff) | |
download | tor-7026b607a0b873ddbee16d5bd8ac2975c7092f5b.tar.gz tor-7026b607a0b873ddbee16d5bd8ac2975c7092f5b.zip |
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);
instead.
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 e59f0d4cb964387c5, not in any released Tor.
Diffstat (limited to 'src')
-rw-r--r-- | src/or/routerkeys.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c index d5e7051296..ca32228fc7 100644 --- a/src/or/routerkeys.c +++ b/src/or/routerkeys.c @@ -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); |