summaryrefslogtreecommitdiff
path: root/devel/nss/patches/patch-nss_lib_util_portreg.c
blob: 41bb5169cd4fa262093048269f101ecf33d48cab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$NetBSD: patch-nss_lib_util_portreg.c,v 1.1 2022/04/07 19:08:40 riastradh Exp $

Fix ctype(3) abuse: https://bugzilla.mozilla.org/show_bug.cgi?id=1246768

--- nss/lib/util/portreg.c.orig	2022-03-03 10:18:53.000000000 +0000
+++ nss/lib/util/portreg.c
@@ -275,7 +275,7 @@ _shexp_match(const char *str, const char
                         if (exp[y] == '\\')
                             ++y;
                         if (case_insensitive) {
-                            matched |= (toupper(str[x]) == toupper(exp[y]));
+                            matched |= (toupper((unsigned char)str[x]) == toupper((unsigned char)exp[y]));
                         } else {
                             matched |= (str[x] == exp[y]);
                         }
@@ -299,7 +299,7 @@ _shexp_match(const char *str, const char
             /* fall through */
             default:
                 if (case_insensitive) {
-                    if (toupper(str[x]) != toupper(exp[y]))
+                    if (toupper((unsigned char)str[x]) != toupper((unsigned char)exp[y]))
                         return NOMATCH;
                 } else {
                     if (str[x] != exp[y])