Changeset 1340 for trunk/pdns/pdns/dnswriter.cc
- Timestamp:
- 02/14/09 16:18:50 (4 years ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/dnswriter.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/dnswriter.cc
r1258 r1340 4 4 #include <boost/tokenizer.hpp> 5 5 #include <boost/algorithm/string.hpp> 6 #include <limits.h> 6 7 7 8 DNSPacketWriter::DNSPacketWriter(vector<uint8_t>& content, const string& qname, uint16_t qtype, uint16_t qclass, uint8_t opcode) … … 149 150 else 150 151 for(; beg!=tok.end(); ++beg){ 151 d_record.push_back(beg->length()); 152 const uint8_t* ptr=(uint8_t*)(beg->c_str()); 153 d_record.insert(d_record.end(), ptr, ptr+beg->length()); 152 if(beg->empty()) 153 d_record.push_back(0); 154 else 155 for (unsigned int i = 0; i < beg->length(); i += 0xff){ 156 d_record.push_back(min(0xffU, beg->length()-i)); 157 const uint8_t* ptr=(uint8_t*)(beg->c_str()) + i; 158 d_record.insert(d_record.end(), ptr, ptr+min(0xffU, beg->length()-i)); 159 } 154 160 } 155 161 }