return dns_label_match(start, a, b);
}
-/** Compress "label" by looking at buffer in start..end
+/** Compress "label" by looking for other labels in start..end
+ *
+ * We assume that the input is valid. If it isn't valid, bad things
+ * will happen.
*
* "label" MUST be uncompressed.
*/
*/
if (value->type != FR_TYPE_STRING) return -1;
+ if (value->vb_length > 255) {
+ fr_strerror_printf("Label is too long");
+ return -1;
+ }
+
/*
* '.' or empty string is special, and is encoded as a
* plain zero byte.
}
/*
- * For now we don't do compression. We just encode the
- * label as-is.
+ * For now, just encode the value as-is. We do
+ * compression as a second step.
*
* We need a minimum length of string + beginning length
* + trailing zero. Intermediate '.' are converted to
/*
* @todo - encode into a local buffer, and then try to
- * compress it into the output buffer. This means that
+ * compress that into the output buffer. This means that
* the output buffer can be a little bit smaller.
*/
while (q < strend) {