log_write(0, LOG_MAIN|LOG_PANIC, "backtrace");
log_write(0, LOG_MAIN|LOG_PANIC, "---");
+
+/* This function is officially not callable from a signal handler, as it
+calls malloc() for the returned data. However, it seems to work - and we
+know we're going on to crash anyway - so just hold our noses and do it.
+A alternative might be backtrace_symbols_fd(). */
+
if ((ss = backtrace_symbols(buf, nptrs)))
{
for (int i = 0; i < nptrs; i++)
static inline uschar
gstring_last_char(gstring * g)
{
-return g ? g->s[g->ptr-1] : '\0';
+return g && g->ptr > 0 ? g->s[g->ptr-1] : '\0';
}
static inline void
if (!(dkim_private_key_expanded = expand_string(dkim->dkim_private_key)))
{ errwhen = US"dkim_private_key"; goto expand_bad; }
- if ( Ustrlen(dkim_private_key_expanded) == 0
+ if ( dkim_private_key_expanded[0] == '\0'
|| Ustrcmp(dkim_private_key_expanded, "0") == 0
|| Ustrcmp(dkim_private_key_expanded, "false") == 0
)
die_tainted(US"string_nextinlist", func, line);
for (; *s; s++)
{
- if (*s == sep && (*(++s) != sep || sep_is_special)) break;
+ if (*s == sep && (*++s != sep || sep_is_special)) break;
if (p < buflen - 1) buffer[p++] = *s;
}
while (p > 0 && isspace(buffer[p-1])) p--;