summaryrefslogtreecommitdiff
path: root/src/lib/libc
diff options
context:
space:
mode:
authorflorian <>2022-11-16 18:30:12 +0000
committerflorian <>2022-11-16 18:30:12 +0000
commit6f8d4c4c4cdd0843000799b6361ddf6edb10edcd (patch)
tree038f37a8ec0e678474538305af050f20ddc51eaa /src/lib/libc
parent0531d6e5f0d60af336ea5d584147ec73768c16d8 (diff)
downloadopenbsd-6f8d4c4c4cdd0843000799b6361ddf6edb10edcd.tar.gz
openbsd-6f8d4c4c4cdd0843000799b6361ddf6edb10edcd.tar.bz2
openbsd-6f8d4c4c4cdd0843000799b6361ddf6edb10edcd.zip
tolower(3) guarantees to return its argument unchanged if it's not
uppercase. While here use the correct idiom of casting to unsigned char. OK millert, farewell to ultrix deraadt
Diffstat (limited to 'src/lib/libc')
-rw-r--r--src/lib/libc/net/res_comp.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/lib/libc/net/res_comp.c b/src/lib/libc/net/res_comp.c
index e637f4a958..41a1c9771a 100644
--- a/src/lib/libc/net/res_comp.c
+++ b/src/lib/libc/net/res_comp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: res_comp.c,v 1.20 2016/05/01 15:17:29 millert Exp $ */ 1/* $OpenBSD: res_comp.c,v 1.21 2022/11/16 18:30:12 florian Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1985, 1993 4 * ++Copyright++ 1985, 1993
@@ -261,14 +261,6 @@ __dn_skipname(const u_char *comp_dn, const u_char *eom)
261 return (cp - comp_dn); 261 return (cp - comp_dn);
262} 262}
263 263
264static int
265mklower(int ch)
266{
267 if (isascii(ch) && isupper(ch))
268 return (tolower(ch));
269 return (ch);
270}
271
272/* 264/*
273 * Search for expanded name from a list of previously compressed names. 265 * Search for expanded name from a list of previously compressed names.
274 * Return the offset from msg if found or -1. 266 * Return the offset from msg if found or -1.
@@ -296,7 +288,8 @@ dn_find(u_char *exp_dn, u_char *msg, u_char **dnptrs, u_char **lastdnptr)
296 goto next; 288 goto next;
297 if (*dn == '\\') 289 if (*dn == '\\')
298 dn++; 290 dn++;
299 if (mklower(*dn++) != mklower(*cp++)) 291 if (tolower((unsigned char)*dn++) !=
292 tolower((unsigned char)*cp++))
300 goto next; 293 goto next;
301 } 294 }
302 if ((n = *dn++) == '\0' && *cp == '\0') 295 if ((n = *dn++) == '\0' && *cp == '\0')