summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2019-06-12 10:06:30 -0400
committerThomas Markwalder <tmark@isc.org>2019-06-12 10:06:30 -0400
commit97c155273c0df0c8518f226e2b5e338e3ad63e87 (patch)
treeb4510c673655b2befb98ab9f77cbf203cc636dd5
parent9bb1ce338651eefdaff33558f30ed6acdc4057c6 (diff)
parent71277027e98bcd94692406746b0685a7032d9fba (diff)
downloadisc-dhcp-97c155273c0df0c8518f226e2b5e338e3ad63e87.tar.gz
[master] GCC 9 compilation errors fixed.
Merge branch '15-confpars-c-has-invalid-error-messages-when-memory-allocation-fails'
-rw-r--r--RELNOTES10
-rw-r--r--common/discover.c4
-rw-r--r--common/parse.c24
-rw-r--r--includes/dhcpd.h3
-rw-r--r--includes/omapip/omapip_p.h3
-rw-r--r--omapip/errwarn.c17
-rw-r--r--relay/dhcrelay.c4
-rw-r--r--server/confpars.c6
8 files changed, 43 insertions, 28 deletions
diff --git a/RELNOTES b/RELNOTES
index 7294a458..7e9e7e4b 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -102,7 +102,7 @@ by Eric Young (eay@cryptsoft.com).
than in seconds (via ping-timeout). When greater than zero, the value
of ping-timeout-ms will override the value of ping-timeout. Thanks
to Jay Doran from Bluecat Networks for suggesting this feature.
- [ISC-Bugs #10,!6 git ebe4f7ae427fa91f561a0b6e5f242de08d319a16]
+ [ISC-Bugs #10,!6 git ebe4f7ae427fa91f561a0b6e5f242de08d319a16]
Changes since 4.4.1 (Bug Fixes)
@@ -127,13 +127,17 @@ by Eric Young (eay@cryptsoft.com).
- Corrected a compilation issue that occurred when building without DNS
update ability (e.g. by undefining NSUPDATE).
- [ISC-Bugs #16,!9 git ddb508ac083dae4ff83279dd240bad7f73a97b7d]
+ [ISC-Bugs #16,!9 git ddb508ac083dae4ff83279dd240bad7f73a97b7d]
- Corrected an issue that was causing the server, when running in
DHPCv4 mode, to segfault when class lease limits are reached.
Thanks to Peter Nagy at Porion-Digital for reporting the matter
and submitting a patch.
- [ISC-Bugs #13,!7 git dfcbe359ab278cad70015994ca73ef50d626b23a]
+ [ISC-Bugs #13,!7 git dfcbe359ab278cad70015994ca73ef50d626b23a]
+
+- Made minor changes to eliminate warnings when compiled with GCC 9.
+ Thanks to Brett Neumeier for bringing the matter to our attention.
+ [ISC-Bugs #15,!10 git c138f38bd00ceca4e1e51a4db7542a15ef79babd]
Changes since 4.4.0 (New Features)
- none
diff --git a/common/discover.c b/common/discover.c
index 6ef88529..226dbc4a 100644
--- a/common/discover.c
+++ b/common/discover.c
@@ -643,7 +643,9 @@ discover_interfaces(int state) {
log_fatal("Error allocating interface %s: %s",
info.name, isc_result_totext(status));
}
- strncpy(tmp->name, info.name, sizeof(tmp->name) - 1);
+
+ memcpy(tmp->name, info.name, sizeof(tmp->name));
+
interface_snorf(tmp, ir);
interface_dereference(&tmp, MDL);
tmp = interfaces; /* XXX */
diff --git a/common/parse.c b/common/parse.c
index 3ac4ebf7..c0fa4050 100644
--- a/common/parse.c
+++ b/common/parse.c
@@ -3,7 +3,7 @@
Common parser code for dhcpd and dhclient. */
/*
- * Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2019 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -5566,19 +5566,25 @@ int parse_warn (struct parse *cfile, const char *fmt, ...)
{
va_list list;
char lexbuf [256];
- char mbuf [1024];
- char fbuf [1024];
+ char mbuf [1024]; /* errorwarn.c CVT_BUF_MAX + 1 */
+ char fbuf [2048];
+ char final[4096];
unsigned i, lix;
-
- do_percentm (mbuf, fmt);
+
+ /* Replace %m in fmt with errno error text */
+ do_percentm (mbuf, sizeof(mbuf), fmt);
+
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
*/
+
+ /* Prepend the file and line number */
snprintf (fbuf, sizeof fbuf, "%s line %d: %s",
cfile -> tlname, cfile -> lexline, mbuf);
-
+
+ /* Now add the var args to the format for the final log message. */
va_start (list, fmt);
- vsnprintf (mbuf, sizeof mbuf, fbuf, list);
+ vsnprintf (final, sizeof final, fbuf, list);
va_end (list);
lix = 0;
@@ -5594,14 +5600,14 @@ int parse_warn (struct parse *cfile, const char *fmt, ...)
lexbuf [lix] = 0;
#ifndef DEBUG
- syslog (LOG_ERR, "%s", mbuf);
+ syslog (LOG_ERR, "%s", final);
syslog (LOG_ERR, "%s", cfile -> token_line);
if (cfile -> lexchar < 81)
syslog (LOG_ERR, "%s^", lexbuf);
#endif
if (log_perror) {
- IGNORE_RET (write (STDERR_FILENO, mbuf, strlen (mbuf)));
+ IGNORE_RET (write (STDERR_FILENO, final, strlen (final)));
IGNORE_RET (write (STDERR_FILENO, "\n", 1));
IGNORE_RET (write (STDERR_FILENO, cfile -> token_line,
strlen (cfile -> token_line)));
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
index 2907fcfa..d4c81fc1 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -3,7 +3,7 @@
Definitions for dhcpd... */
/*
- * Copyright (c) 2004-2018 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2019 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -1393,6 +1393,7 @@ struct interface_info {
unsigned remote_id_len; /* Length of Remote ID. */
char name [IFNAMSIZ]; /* Its name... */
+
int index; /* Its if_nametoindex(). */
int rfdesc; /* Its read file descriptor. */
int wfdesc; /* Its write file descriptor, if
diff --git a/includes/omapip/omapip_p.h b/includes/omapip/omapip_p.h
index 7fe1eba5..c92f9420 100644
--- a/includes/omapip/omapip_p.h
+++ b/includes/omapip/omapip_p.h
@@ -288,7 +288,8 @@ int log_info (const char *, ...)
__attribute__((__format__(__printf__,1,2)));
int log_debug (const char *, ...)
__attribute__((__format__(__printf__,1,2)));
-void do_percentm (char *obuf, const char *ibuf);
+
+void do_percentm (char *obuf, size_t obufsize, const char *ibuf);
isc_result_t uerr2isc (int);
isc_result_t ns_rcode_to_isc (int);
diff --git a/omapip/errwarn.c b/omapip/errwarn.c
index e30f8a0d..2bb50fd0 100644
--- a/omapip/errwarn.c
+++ b/omapip/errwarn.c
@@ -54,7 +54,7 @@ void log_fatal (const char * fmt, ... )
{
va_list list;
- do_percentm (fbuf, fmt);
+ do_percentm (fbuf, sizeof fbuf, fmt);
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
@@ -93,7 +93,7 @@ int log_error (const char * fmt, ...)
{
va_list list;
- do_percentm (fbuf, fmt);
+ do_percentm (fbuf, sizeof fbuf, fmt);
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
@@ -120,7 +120,7 @@ int log_info (const char *fmt, ...)
{
va_list list;
- do_percentm (fbuf, fmt);
+ do_percentm (fbuf, sizeof fbuf, fmt);
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
@@ -147,7 +147,7 @@ int log_debug (const char *fmt, ...)
{
va_list list;
- do_percentm (fbuf, fmt);
+ do_percentm (fbuf, sizeof fbuf, fmt);
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
@@ -170,8 +170,9 @@ int log_debug (const char *fmt, ...)
/* Find %m in the input string and substitute an error message string. */
-void do_percentm (obuf, ibuf)
+void do_percentm (obuf, obufsize, ibuf)
char *obuf;
+ size_t obufsize;
const char *ibuf;
{
const char *s = ibuf;
@@ -191,13 +192,13 @@ void do_percentm (obuf, ibuf)
if (!m)
m = "<unknown error>";
len += strlen (m);
- if (len > CVT_BUF_MAX)
+ if (len > obufsize - 1)
goto out;
strcpy (p - 1, m);
p += strlen (p);
++s;
} else {
- if (++len > CVT_BUF_MAX)
+ if (++len > obufsize - 1)
goto out;
*p++ = *s++;
}
@@ -205,7 +206,7 @@ void do_percentm (obuf, ibuf)
} else {
if (*s == '%')
infmt = 1;
- if (++len > CVT_BUF_MAX)
+ if (++len > obufsize - 1)
goto out;
*p++ = *s++;
}
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index d8caaaf6..dd8e446d 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -3,7 +3,7 @@
DHCP/BOOTP Relay Agent. */
/*
- * Copyright(c) 2004-2018 by Internet Systems Consortium, Inc.("ISC")
+ * Copyright(c) 2004-2019 by Internet Systems Consortium, Inc.("ISC")
* Copyright(c) 1997-2003 by Internet Software Consortium
*
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -2119,7 +2119,7 @@ void request_v4_interface(const char* name, int flags) {
(flags & INTERFACE_UPSTREAM ? 'Y' : 'N'),
(flags & INTERFACE_DOWNSTREAM ? 'Y' : 'N'));
- strncpy(tmp->name, name, len);
+ memcpy(tmp->name, name, len);
interface_snorf(tmp, (INTERFACE_REQUESTED | flags));
interface_dereference(&tmp, MDL);
}
diff --git a/server/confpars.c b/server/confpars.c
index d2cedfe0..7ad28d55 100644
--- a/server/confpars.c
+++ b/server/confpars.c
@@ -3,7 +3,7 @@
Parser for dhcpd config file... */
/*
- * Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2019 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -911,7 +911,7 @@ void parse_failover_peer (cfile, group, type)
if (is_identifier (token) || token == STRING) {
name = dmalloc (strlen (val) + 1, MDL);
if (!name)
- log_fatal ("no memory for peer name %s", name);
+ log_fatal ("no memory for peer name %s", val);
strcpy (name, val);
} else {
parse_warn (cfile, "expecting failover peer name.");
@@ -1226,7 +1226,7 @@ void parse_failover_state_declaration (struct parse *cfile,
name = dmalloc (strlen (val) + 1, MDL);
if (!name)
log_fatal ("failover peer name %s: no memory",
- name);
+ val);
strcpy (name, val);
} else {
parse_warn (cfile, "expecting failover peer name.");