Commit 7c975ed4 authored by Francis Dupont's avatar Francis Dupont
Browse files

[master] Merged trac5101 (Coverity fixes)

parents 94e8a6e4 1726052c
// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -16,7 +16,7 @@ namespace isc {
namespace dhcp {
Parser4Context::Parser4Context()
: trace_scanning_(false), trace_parsing_(false)
: ctx_(NO_KEYWORD), trace_scanning_(false), trace_parsing_(false)
{
}
......
// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -16,7 +16,7 @@ namespace isc {
namespace dhcp {
Parser6Context::Parser6Context()
: trace_scanning_(false), trace_parsing_(false)
: ctx_(NO_KEYWORD), trace_scanning_(false), trace_parsing_(false)
{
}
......
// Copyright (C) 2010-2016 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2010-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -798,11 +798,13 @@ StringElement::toJSON(std::ostream& ss) const {
break;
default:
if ((c >= 0) && (c < 0x20)) {
ss << "\\u"
<< hex
<< setw(4)
<< setfill('0')
<< (static_cast<unsigned>(c) & 0xff);
std::ostringstream esc;
esc << "\\u"
<< hex
<< setw(4)
<< setfill('0')
<< (static_cast<unsigned>(c) & 0xff);
ss << esc.str();
} else {
ss << c;
}
......
// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -420,7 +420,12 @@ OptionDataTypeUtil::readPsid(const std::vector<uint8_t>& buf) {
// All is good, so we can convert the PSID value read from the buffer to
// the port set number.
psid = psid >> (sizeof(psid) * 8 - psid_len);
if (psid_len == sizeof(psid) * 8) {
// Shift by 16 always gives zero (CID 1398333)
psid = 0;
} else {
psid = psid >> (sizeof(psid) * 8 - psid_len);
}
return (std::make_pair(PSIDLen(psid_len), PSID(psid)));
}
......
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