]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Don't call the system toupper or tolower.
authorNick Mathewson <nickm@torproject.org>
Wed, 6 Apr 2016 03:22:28 +0000 (23:22 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 6 Apr 2016 03:22:28 +0000 (23:22 -0400)
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.

changes/bug18728 [new file with mode: 0644]
src/ext/readpassphrase.c
src/ext/tor_readpassphrase.h
src/test/test_util.c

diff --git a/changes/bug18728 b/changes/bug18728
new file mode 100644 (file)
index 0000000..e181c17
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes (build):
+    - Resolve warnings when building on systems that are concerned with
+      signed char. Fixes bug 18728; bugfix on 0.2.7.2-alpha and 
+      0.2.6.1-alpha.
index ab7193585978202435f86aae3b9b9774df85e9a4..e0df05d7b7830e46ee375e55312ce1ca16951b89 100644 (file)
@@ -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;
                        }
                }
index 83ae1f20a811343e87d6a74b692b620753a1e4e7..64f5668cad3946e38ba84b8654916ffaa5f927e2 100644 (file)
 #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);
index 7d43b8156b0fb785e192a69ad38086064222123a..21ff75741a150b99a48028867e9841da37e88c0e 100644 (file)
@@ -2297,7 +2297,8 @@ test_util_sscanf(void *arg)
 }
 
 #define tt_char_op(a,op,b) tt_assert_op_type(a,op,b,char,"%c")
-#define tt_ci_char_op(a,op,b) tt_char_op(tolower(a),op,tolower(b))
+#define tt_ci_char_op(a,op,b) \
+  tt_char_op(TOR_TOLOWER((int)a),op,TOR_TOLOWER((int)b))
 
 #ifndef HAVE_STRNLEN
 static size_t