Skip to content

Commit

Permalink
ensure log context category is valid before reading it
Browse files Browse the repository at this point in the history
category of logs accessed via log context can be null
in such a case, strcmp will crash

Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Oct 7, 2024
1 parent 3974040 commit 35d4f91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libsync/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 35d4f91

Please sign in to comment.