diff options
author | florian <> | 2022-11-16 18:30:12 +0000 |
---|---|---|
committer | florian <> | 2022-11-16 18:30:12 +0000 |
commit | 70ba26132a96552e1ecb01775c299ad56fc02dc4 (patch) | |
tree | 038f37a8ec0e678474538305af050f20ddc51eaa | |
parent | 3eadcf3d05825c033723aad78636f716f72f2fb2 (diff) | |
download | openbsd-70ba26132a96552e1ecb01775c299ad56fc02dc4.tar.gz openbsd-70ba26132a96552e1ecb01775c299ad56fc02dc4.tar.bz2 openbsd-70ba26132a96552e1ecb01775c299ad56fc02dc4.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
-rw-r--r-- | src/lib/libc/net/res_comp.c | 13 |
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 | ||
264 | static int | ||
265 | mklower(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') |