Skip to content
Snippets Groups Projects
Commit b45065ec authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Do not insert compression offsets exceeding maximum (16383).

Change-Id: I952c5ae76fc1dca9d7e824ef55e55e4393a27d7d
parent 0a517d2e
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,9 @@
/*----------------------------------------------------------------------------*/
/* Only last 14bits of 16bit ptr are reserved for offset. */
#define COMPR_MAX_OFFSET 16383
/*!
* \brief Compare suffixes and calculate score (number of matching labels).
*
......@@ -128,6 +131,10 @@ int knot_response_compress_dname(const knot_dname_t *dname,
written += 1;
}
/* Do not insert if exceeds bounds. */
if (compr->wire_pos > COMPR_MAX_OFFSET)
return written;
/* If table is full, elect name from the lower 1/4 of the table
* and replace it. */
if (i == COMPR_MAXLEN - 1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment