BIND 10 #2272: Improve the perfdhcp command_options_helper code.
BIND 10 Development
do-not-reply at isc.org
Fri Sep 21 14:49:07 UTC 2012
#2272: Improve the perfdhcp command_options_helper code.
-------------------------------------+-------------------------------------
Reporter: | Owner: marcin
marcin | Status: reviewing
Type: | Milestone: Sprint-
defect | DHCP-20121004
Priority: | Resolution:
medium | Sensitive: 0
Component: | Sub-Project: DHCP
Unclassified | Estimated Difficulty: 0
Keywords: | Total Hours: 0
Defect Severity: N/A |
Feature Depending on Ticket: |
Add Hours to Ticket: 0 |
Internal?: 0 |
-------------------------------------+-------------------------------------
Changes (by stephen):
* owner: stephen => marcin
Comment:
Reviewed commit 3148cf2b018b222e263894b80cd7e92b20c86ceb
'''configure.ac'''[[BR]]
Missing semicolon at the end of the "optreset=1" statement in the
AC_TRY_LINK code for checking optreset. (Although according to my
config.log, configure added one anyway.)
'''tests/tools/perfdhcp/tests/command_options_helper.h'''[[BR]]
The "results" array allocated is too long: the number of elements in the
array should not be multiplied by "sizeof(char*)".
The !CommandOptionsHelper class is only used in unit tests using Gtest.
With this in mind, when allocating memory with "new", rather than using
"new (std::nothrow)" then an assert() to check that the returned result is
non-null, why not write a standard "new" within an EXPECT_NO_THROW?
'''tests/tools/perfdhcp/tests/command_options_helper.cc'''[[BR]]
> There are at least two ways to reset the state of the getopt() to
prevent it from trying to access freed buffers. On Linux: the optind must
be set to 0. This however does not work on BSD and MacOS where there is an
additional variable declared: optreset. On those systems both optreset and
optind must be set to 1.
This seems to imply that both optind and optreset must be set to 1 on BSD
systems only (i.e. with HAVE_OPTRESET set to 1). However the code only
sets optreset according to this preprocessor symbol; the setting of optind
is determined by the macro !__GLIBC!__.
--
Ticket URL: <http://bind10.isc.org/ticket/2272#comment:5>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list