// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
+#include <config.h>
+
#include <dns/master_loader.h>
#include <dns/master_lexer.h>
#include <dns/name.h>
continue;
}
- // 'it' can be equal to str.end() here, but it is handled
- // correctly.
- if (*it != '{') {
+ // The str.end() check is required.
+ if ((it == str.end()) || (*it != '{')) {
// There is no modifier (between {}), so just copy the
// passed number into the generated string.
rstr += boost::str(boost::format("%d") % num);
const size_t self_len = self[0];
const size_t other_len = other[0];
const size_t cmp_len = std::min(self_len, other_len);
+ if (cmp_len == 0) {
+ if (self_len < other_len) {
+ return (-1);
+ } else if (self_len > other_len) {
+ return (1);
+ } else {
+ return (0);
+ }
+ }
const int cmp = std::memcmp(&self[1], &other[1], cmp_len);
if (cmp < 0) {
return (-1);
-// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
const size_t this_len = impl_->keydata_.size();
const size_t other_len = other_dnskey.impl_->keydata_.size();
const size_t cmplen = min(this_len, other_len);
+ if (cmplen == 0) {
+ return ((this_len == other_len) ? 0 : (this_len < other_len) ? -1 : 1);
+ }
const int cmp = memcmp(&impl_->keydata_[0],
&other_dnskey.impl_->keydata_[0], cmplen);
if (cmp != 0) {
-// Copyright (C) 2010-2013 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2013, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
boost::shared_ptr<std::vector<uint8_t> >
option_data(new std::vector<uint8_t>(length));
- std::memcpy(&(*option_data)[0], data, length);
+ if (length != 0) {
+ std::memcpy(&(*option_data)[0], data, length);
+ }
impl_->pseudo_rrs_.push_back(PseudoRR(code, option_data));
impl_->rdlength_ += length;
}
const size_t this_len = impl_->keydata_.size();
const size_t other_len = other_dnskey.impl_->keydata_.size();
const size_t cmplen = min(this_len, other_len);
+ if (cmplen == 0) {
+ return ((this_len == other_len) ? 0 : (this_len < other_len) ? -1 : 1);
+ }
const int cmp = memcmp(&impl_->keydata_[0],
&other_dnskey.impl_->keydata_[0], cmplen);
if (cmp != 0) {
boost::shared_ptr<std::vector<uint8_t> >
option_data(new std::vector<uint8_t>(length));
- std::memcpy(&(*option_data)[0], data, length);
+ if (length != 0) {
+ std::memcpy(&(*option_data)[0], data, length);
+ }
impl_->pseudo_rrs_.push_back(PseudoRR(code, option_data));
impl_->rdlength_ += length;
}