[exim-cvs] tidying

Pàgina inicial
Delete this message
Reply to this message
Autor: Exim Git Commits Mailing List
Data:  
A: exim-cvs
Assumpte: [exim-cvs] tidying
Gitweb: https://git.exim.org/exim.git/commitdiff/4e18743562ada3d4dcee8121b8ecf750369f0e5b
Commit:     4e18743562ada3d4dcee8121b8ecf750369f0e5b
Parent:     2506b3e03ffd4617cec535b45ae1f8cb5db5e799
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Sep 17 13:31:57 2024 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Fri Oct 25 14:32:15 2024 +0100


    tidying
---
 src/src/exim.c          | 6 ++++++
 src/src/functions.h     | 2 +-
 src/src/miscmods/dkim.c | 2 +-
 src/src/string.c        | 2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)


diff --git a/src/src/exim.c b/src/src/exim.c
index 0eb221d43..a95723f0d 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -257,6 +257,12 @@ int nptrs = backtrace(buf, STACKDUMP_MAX);

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++)
diff --git a/src/src/functions.h b/src/src/functions.h
index 57c4bb45c..b581af78b 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -991,7 +991,7 @@ return g ? (unsigned)g->ptr : 0;
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
diff --git a/src/src/miscmods/dkim.c b/src/src/miscmods/dkim.c
index bd1625187..5b18dbcb0 100644
--- a/src/src/miscmods/dkim.c
+++ b/src/src/miscmods/dkim.c
@@ -995,7 +995,7 @@ if (dkim_domain)
     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
        )
diff --git a/src/src/string.c b/src/src/string.c
index 1169f0e2c..d4fb23cb6 100644
--- a/src/src/string.c
+++ b/src/src/string.c
@@ -957,7 +957,7 @@ if (buffer)
     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--;


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-cvs.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-cvs-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/