Commit ddd815eb authored by JINMEI Tatuya's avatar JINMEI Tatuya Committed by Jeremy C. Reed

[master] fix clang static analyzer issue

Value stored to 'opt_len' during its initialization is never read

discussed via jabber

also use const
parent 214e0409
......@@ -196,12 +196,10 @@ PktTransform::unpackOptions(const OptionBuffer& in_buffer,
// Get option length which is supposed to be after option type.
offset += offset_step;
uint16_t opt_len = in_buffer[offset] * 256 + in_buffer[offset + 1];
if (option->getUniverse() == Option::V6) {
opt_len = in_buffer[offset] * 256 + in_buffer[offset + 1];
} else {
opt_len = in_buffer[offset];
}
const uint16_t opt_len =
(option->getUniverse() == Option::V6) ?
in_buffer[offset] * 256 + in_buffer[offset + 1] :
in_buffer[offset];
// Check if packet is not truncated.
if (offset + option->getHeaderLen() + opt_len > in_buffer.size()) {
......
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