From d7a0382ba337bd1cbd7568a607d85e303012b22c Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 5 Apr 2016 23:22:28 -0400 Subject: Don't call the system toupper or tolower. Yes, we could cast to unsigned char first, but it's probably safest to just use our own (in test_util), or remove bad-idea features that we don't use (in readpassphrase.c). Fixes 18728. --- src/ext/readpassphrase.c | 2 ++ src/ext/tor_readpassphrase.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src/ext') diff --git a/src/ext/readpassphrase.c b/src/ext/readpassphrase.c index ab71935859..e0df05d7b7 100644 --- a/src/ext/readpassphrase.c +++ b/src/ext/readpassphrase.c @@ -142,6 +142,7 @@ restart: p = buf; while ((nr = read(input, &ch, 1)) == 1 && ch != '\n' && ch != '\r') { if (p < end) { +#if 0 if ((flags & RPP_SEVENBIT)) ch &= 0x7f; if (isalpha(ch)) { @@ -150,6 +151,7 @@ restart: if ((flags & RPP_FORCEUPPER)) ch = (char)toupper(ch); } +#endif *p++ = ch; } } diff --git a/src/ext/tor_readpassphrase.h b/src/ext/tor_readpassphrase.h index 83ae1f20a8..64f5668cad 100644 --- a/src/ext/tor_readpassphrase.h +++ b/src/ext/tor_readpassphrase.h @@ -32,9 +32,11 @@ #define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */ #define RPP_ECHO_ON 0x01 /* Leave echo on. */ #define RPP_REQUIRE_TTY 0x02 /* Fail if there is no tty. */ +#if 0 #define RPP_FORCELOWER 0x04 /* Force input to lower case. */ #define RPP_FORCEUPPER 0x08 /* Force input to upper case. */ #define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */ +#endif #define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */ char * readpassphrase(const char *, char *, size_t, int); -- cgit v1.2.3-54-g00ecf