-/* $OpenBSD: asr.c,v 1.67 2021/11/22 20:18:27 jca Exp $ */
+/* $OpenBSD: asr.c,v 1.68 2022/01/20 14:18:10 naddy Exp $ */
/*
* Copyright (c) 2010-2012 Eric Faurot <eric@openbsd.org>
*
{
const unsigned char *dname = _dname;
char *res;
- size_t left, n, count;
+ size_t left, count;
if (_dname[0] == 0) {
strlcpy(buf, ".", max);
res = buf;
left = max - 1;
- for (n = 0; dname[0] && left; n += dname[0]) {
+ while (dname[0] && left) {
count = (dname[0] < (left - 1)) ? dname[0] : (left - 1);
memmove(buf, dname + 1, count);
dname += dname[0] + 1;
-/* $OpenBSD: res_mkquery.c,v 1.2 2018/12/15 15:16:12 eric Exp $ */
+/* $OpenBSD: res_mkquery.c,v 1.3 2022/01/20 14:18:10 naddy Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
{
const unsigned char *dname = _dname;
char *res;
- size_t left, n, count;
+ size_t left, count;
if (_dname[0] == 0) {
strlcpy(buf, ".", max);
res = buf;
left = max - 1;
- for (n = 0; dname[0] && left; n += dname[0]) {
+ while (dname[0] && left) {
count = (dname[0] < (left - 1)) ? dname[0] : (left - 1);
memmove(buf, dname + 1, count);
dname += dname[0] + 1;
-/* $OpenBSD: res_query.c,v 1.3 2018/12/15 15:16:12 eric Exp $ */
+/* $OpenBSD: res_query.c,v 1.4 2022/01/20 14:18:10 naddy Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
{
const unsigned char *dname = _dname;
char *res;
- size_t left, n, count;
+ size_t left, count;
if (_dname[0] == 0) {
strlcpy(buf, ".", max);
res = buf;
left = max - 1;
- for (n = 0; dname[0] && left; n += dname[0]) {
+ while (dname[0] && left) {
count = (dname[0] < (left - 1)) ? dname[0] : (left - 1);
memmove(buf, dname + 1, count);
dname += dname[0] + 1;
-/* $OpenBSD: unpack_dns.c,v 1.2 2021/06/14 17:58:16 eric Exp $ */
+/* $OpenBSD: unpack_dns.c,v 1.3 2022/01/20 14:18:10 naddy Exp $ */
/*
* Copyright (c) 2011-2014 Eric Faurot <eric@faurot.net>
{
const unsigned char *dname = _dname;
char *res;
- size_t left, n, count;
+ size_t left, count;
if (_dname[0] == 0) {
(void)strlcpy(buf, ".", max);
res = buf;
left = max - 1;
- for (n = 0; dname[0] && left; n += dname[0]) {
+ while (dname[0] && left) {
count = (dname[0] < (left - 1)) ? dname[0] : (left - 1);
memmove(buf, dname + 1, count);
dname += dname[0] + 1;