From: Matthieu Gallien Date: Mon, 7 Oct 2024 12:16:50 +0000 (+0200) Subject: ensure log context category is valid before reading it X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~5^2~139^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=35d4f91b42f7b468bfe01ee160900f419b409a90;p=nextcloud-desktop.git ensure log context category is valid before reading it category of logs accessed via log context can be null in such a case, strcmp will crash Signed-off-by: Matthieu Gallien --- diff --git a/src/libsync/logger.cpp b/src/libsync/logger.cpp index 5e84be48a..86f482fff 100644 --- a/src/libsync/logger.cpp +++ b/src/libsync/logger.cpp @@ -148,7 +148,7 @@ void Logger::doLog(QtMsgType type, const QMessageLogContext &ctx, const QString if (_doFileFlush) _logstream->flush(); } - if (_permanentDeleteLogStream && strcmp(ctx.category, lcPermanentLog().categoryName()) == 0) { + if (_permanentDeleteLogStream && ctx.category && strcmp(ctx.category, lcPermanentLog().categoryName()) == 0) { (*_permanentDeleteLogStream) << msg << "\n"; _permanentDeleteLogStream->flush(); if (_permanentDeleteLogFile.size() > 10LL * 1024LL) {