diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-07-19 07:55:27 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-07-19 07:56:13 +0200 |
commit | cff2c78c513ef8d51e69a6933f1c6aef8a24a6d6 (patch) | |
tree | c02340cf73c5d1a9ff330ef9e6e3766ddd09c0b7 /resolv/ns_name.c | |
parent | 248dbed1187038918d79f62cd9cf631f4150c2a0 (diff) | |
download | glibc-cff2c78c513ef8d51e69a6933f1c6aef8a24a6d6.tar.gz glibc-cff2c78c513ef8d51e69a6933f1c6aef8a24a6d6.tar.xz glibc-cff2c78c513ef8d51e69a6933f1c6aef8a24a6d6.zip |
resolv: Move ns_name_skip to its own file and into libc (bug 28091)
And reformat to GNU style. Avoid out-of-bounds pointer arithmetic. This also results in a fix of bug 28091 due to the additional packet length checks. The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Carlos O'Donell <carlos@systemhalted.org>
Diffstat (limited to 'resolv/ns_name.c')
-rw-r--r-- | resolv/ns_name.c | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/resolv/ns_name.c b/resolv/ns_name.c index a0d541f110..58d6a60ce4 100644 --- a/resolv/ns_name.c +++ b/resolv/ns_name.c @@ -397,43 +397,6 @@ ns_name_rollback(const u_char *src, const u_char **dnptrs, } } -/*% - * Advance *ptrptr to skip over the compressed name it points at. - * - * return: - *\li 0 on success, -1 (with errno set) on failure. - */ -int -ns_name_skip(const u_char **ptrptr, const u_char *eom) -{ - const u_char *cp; - u_int n; - - cp = *ptrptr; - while (cp < eom && (n = *cp++) != 0) { - /* Check for indirection. */ - switch (n & NS_CMPRSFLGS) { - case 0: /*%< normal case, n == len */ - cp += n; - continue; - case NS_CMPRSFLGS: /*%< indirection */ - cp++; - break; - default: /*%< illegal type */ - __set_errno (EMSGSIZE); - return (-1); - } - break; - } - if (cp > eom) { - __set_errno (EMSGSIZE); - return (-1); - } - *ptrptr = cp; - return (0); -} -libresolv_hidden_def (ns_name_skip) - /* Private. */ /*% |