2.3.11.3 mail_cache_open_or_create_path called with null path
Originally reported here - https://marc.info/?l=openbsd-ports&m=159731598419071&w=2
OpenBSD's printf functions have a (mostly annoying but occasionally useful) feature where they generate a syslog entry if printf %s format is called with a null pointer.
It is tripped in lmtp/lda deliveries with 2.3.11.3:
lmtp: vfprintf %s NULL in "Cache %s: " dovecot-lda: vfprintf %s NULL in "Cache %s: "
src/lib-index/mail-cache.c: .. 557 struct mail_cache * 558 mail_cache_open_or_create_path(struct mail_index *index, const char *path) 559 { .. 565 cache->filepath = i_strdup(path); .. 572 event_set_append_log_prefix(cache->event, 573 t_strdup_printf("Cache %s: ", cache->filepath); ..
Seems something is wrong to have this function called with no cache path?
On 13. Aug 2020, at 14.14, Stuart Henderson
Originally reported here - https://marc.info/?l=openbsd-ports&m=159731598419071&w=2
OpenBSD's printf functions have a (mostly annoying but occasionally useful) feature where they generate a syslog entry if printf %s format is called with a null pointer.
It is tripped in lmtp/lda deliveries with 2.3.11.3:
lmtp: vfprintf %s NULL in "Cache %s: " dovecot-lda: vfprintf %s NULL in "Cache %s: "
Thanks. This would fix it: lib-index: Fix cache event's log prefix for in-memory indexes It was either shown as "Cache (null): " or it could have crashed in some OSes. diff --git a/src/lib-index/mail-cache.c b/src/lib-index/mail-cache.c index c7197cd4b8..9f4e58b075 100644 --- a/src/lib-index/mail-cache.c +++ b/src/lib-index/mail-cache.c @@ -569,8 +569,13 @@ mail_cache_open_or_create_path(struct mail_index *index, const char *path) cache->event = event_create(index->event); event_add_category(cache->event, &event_category_mail_cache); - event_set_append_log_prefix(cache->event, - t_strdup_printf("Cache %s: ", cache->filepath)); + if (cache->filepath != NULL) { + event_set_append_log_prefix(cache->event, + t_strdup_printf("Cache %s: ", cache->filepath)); + } else { + event_set_append_log_prefix(cache->event, + "Cache (in-memory index): "); + } cache->dotlock_settings.use_excl_lock = (index->flags & MAIL_INDEX_OPEN_FLAG_DOTLOCK_USE_EXCL) != 0;
participants (2)
-
Stuart Henderson
-
Timo Sirainen