2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-01 14:55:30 +00:00

[master] Fixed coverity issue in dhcrelay

Merges in rt41708
This commit is contained in:
Thomas Markwalder
2016-02-16 15:45:54 -05:00
parent dce576b860
commit cbef159ef0
2 changed files with 16 additions and 2 deletions

View File

@@ -217,6 +217,7 @@ by Eric Young (eay@cryptsoft.com).
suboption to the agent option added for clients directly connected to the suboption to the agent option added for clients directly connected to the
relay. relay.
[ISC-Bugs #34875] [ISC-Bugs #34875]
[ISC-Bugs #41708]
- Add a new global DHCPv6 option, dhcpv6-set-tee-times, which when enabled - Add a new global DHCPv6 option, dhcpv6-set-tee-times, which when enabled
instructs the server to calculate T1 and T2 as recommended in RFC 3315, instructs the server to calculate T1 and T2 as recommended in RFC 3315,

View File

@@ -101,7 +101,7 @@ struct server_list {
struct sockaddr_in to; struct sockaddr_in to;
} *servers; } *servers;
struct interface_info *uplink; struct interface_info *uplink = NULL;
#ifdef DHCPv6 #ifdef DHCPv6
struct stream_list { struct stream_list {
@@ -377,6 +377,11 @@ main(int argc, char **argv) {
if (++i == argc) if (++i == argc)
usage(use_noarg, argv[i-1]); usage(use_noarg, argv[i-1]);
if (uplink) {
usage("more than one uplink (-u) specified: %s"
,argv[i]);
}
/* Allocate the uplink interface */ /* Allocate the uplink interface */
status = interface_allocate(&uplink, MDL); status = interface_allocate(&uplink, MDL);
if (status != ISC_R_SUCCESS) { if (status != ISC_R_SUCCESS) {
@@ -384,7 +389,15 @@ main(int argc, char **argv) {
argv[i], isc_result_totext(status)); argv[i], isc_result_totext(status));
} }
strcpy(uplink->name, argv[i]); if (strlen(argv[i]) >= sizeof(uplink->name)) {
log_fatal("%s: uplink name too long,"
" it cannot exceed: %ld characters",
argv[i], sizeof(uplink->name) - 1);
}
uplink->name[sizeof(uplink->name) - 1] = 0x00;
strncpy(uplink->name, argv[i],
sizeof(uplink->name) - 1);
interface_snorf(uplink, INTERFACE_REQUESTED); interface_snorf(uplink, INTERFACE_REQUESTED);
/* Turn on -a, in case they don't do so explicitly */ /* Turn on -a, in case they don't do so explicitly */