/*
This file is part of GNUnet
- Copyright (C) 2010-2014 GNUnet e.V.
+ Copyright (C) 2010-2014, 2018 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
- * @file dns/dnsparser.c
+ * @file util/dnsparser.c
* @brief helper library to parse DNS packets.
* @author Philipp Toelke
* @author Christian Grothoff
*/
#include "platform.h"
+#if HAVE_LIBIDN2
+#if HAVE_IDN2_H
+#include <idn2.h>
+#elif HAVE_IDN2_IDN2_H
+#include <idn2/idn2.h>
+#endif
+#elif HAVE_LIBIDN
+#if HAVE_IDNA_H
#include <idna.h>
+#elif HAVE_IDN_IDNA_H
+#include <idn/idna.h>
+#endif
+#endif
#if WINDOWS
#include <idn-free.h>
#endif
len = dot - idna_name;
if ( (len >= 64) || (0 == len) )
{
- GNUNET_break (0);
- goto fail; /* segment too long or empty */
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Invalid DNS name `%s': label with %u characters encountered\n",
+ name,
+ (unsigned int) len);
+ goto fail; /* label too long or empty */
}
dst[pos++] = (char) (uint8_t) len;
GNUNET_memcpy (&dst[pos],
{
struct GNUNET_TUN_DnsCertRecord dcert;
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare"
+#endif
if ( (cert->cert_type > UINT16_MAX) ||
(cert->algorithm > UINT8_MAX) )
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
if (*off + sizeof (struct GNUNET_TUN_DnsCertRecord) + cert->certificate_size > dst_len)
return GNUNET_NO;
dcert.cert_type = htons ((uint16_t) cert->cert_type);