Skip to content
Snippets Groups Projects
Commit 80d87b52 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

dname: add maximal label length constant

parent d72eb6bd
Branches
Tags
No related merge requests found
......@@ -34,8 +34,9 @@
/*!
* \brief Basic limits for domain names (RFC 1035).
*/
#define KNOT_DNAME_MAXLEN 255 /*!< 1-byte maximum. */
#define KNOT_DNAME_MAXLABELS 127 /*!< 1-char labels. */
#define KNOT_DNAME_MAXLEN 255 /*!< 1-byte maximum. */
#define KNOT_DNAME_MAXLABELS 127 /*!< 1-char labels. */
#define KNOT_DNAME_MAXLABELLEN 63 /*!< 2^6 - 1 */
/*!
* \brief Address family numbers.
......
......@@ -73,8 +73,8 @@ int knot_dname_wire_check(const uint8_t *name, const uint8_t *endp,
is_compressed = true;
}
} else {
/* Check label length (maximum 63 bytes allowed). */
if (*name > 63)
/* Check label length. */
if (*name > KNOT_DNAME_MAXLABELLEN)
return KNOT_EMALF;
/* Check if there's enough space. */
int lblen = *name + 1;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment