Commit 1d950e29 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2094] make sure small size_t values should fit in 8 bits by assert.

parent 2cc12f15
......@@ -310,9 +310,11 @@ encodeRdata(const rdata::Rdata& rdata, RRClass rrclass, RRType rrtype,
const LabelSequence labels(name);
size_t nlen;
const uint8_t* ndata = labels.getData(&nlen);
assert(nlen < 256); // nlen should fit in 8 bits
size_t olen;
uint8_t offset_holder[Name::MAX_LABELS];
labels.getOffsetData(&olen, offset_holder);
assert(olen < 256); // olen should fit in 8 bits
data_result.push_back(nlen);
data_result.push_back(olen);
data_result.insert(data_result.end(), ndata, ndata + nlen);
......
Markdown is supported
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