summaryrefslogtreecommitdiff
path: root/omapip
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2019-06-11 13:38:59 -0400
committerThomas Markwalder <tmark@isc.org>2019-06-12 09:57:33 -0400
commite119ecf6b782253bfc3528e4779481661e2b9bb8 (patch)
treed4e0780ed8cce4b496514c788628a23e344beaef /omapip
parent753d458b1f257cc2107454db158e14e92fcecb11 (diff)
downloadisc-dhcp-e119ecf6b782253bfc3528e4779481661e2b9bb8.tar.gz
[#15,!10] Addressed review comments
common/discover.c discover_interfaces() - replaced strncpy with memcpy common/parse.c parse_warn() - added final message buffer rather than reuse mbuf, pass size into do_percentm call includes/dhcpd.h struct interface_info - restored size of name includes/omapip/omapip_p.* do_percentm() - added output buffer size parameter omapip/errwarn.c pass size of output buffer into calls to do_percentm
Diffstat (limited to 'omapip')
-rw-r--r--omapip/errwarn.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/omapip/errwarn.c b/omapip/errwarn.c
index e30f8a0d..62e0d5ee 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++;
}