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 */
{
va_list list;
char lexbuf [256];
- char mbuf [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;
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)));
interface (if any). */
unsigned remote_id_len; /* Length of Remote ID. */
- char name [IFNAMSIZ+1]; /* Its name... */
+ char name [IFNAMSIZ]; /* Its name... */
+
int index; /* Its if_nametoindex(). */
int rfdesc; /* Its read file descriptor. */
int wfdesc; /* Its write file descriptor, if
__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);
{
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.
{
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.
{
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.
{
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.
/* 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;
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++;
}
} else {
if (*s == '%')
infmt = 1;
- if (++len > CVT_BUF_MAX)
+ if (++len > obufsize - 1)
goto out;
*p++ = *s++;
}