diff options
Diffstat (limited to 'src/dns.c')
-rw-r--r-- | src/dns.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -53,6 +53,7 @@ const char* perf_dns_rcode_strings[] = { perf_result_t perf_dname_fromstring(const char* str, size_t len, perf_buffer_t* target) { size_t label_len, at; + ssize_t max = 255; const char* orig_str = str; bool is_quoted; @@ -101,6 +102,10 @@ perf_result_t perf_dname_fromstring(const char* str, size_t len, perf_buffer_t* if (label_len > 63) { return PERF_R_FAILURE; } + max -= label_len + 1; + if (max < 0) { + return PERF_R_FAILURE; + } perf_buffer_putuint8(target, label_len); if (is_quoted) { for (at = 0; at < len; at++) { |