Skip to content

Commit

Permalink
Make sure context.file is not null before calling strlen
Browse files Browse the repository at this point in the history
Fixes crash in ciborium
  • Loading branch information
tsdgeos committed Feb 9, 2015
1 parent 1116cb9 commit 154c0d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cpp/capi.cpp
Expand Up @@ -847,7 +847,8 @@ QQmlListProperty_ *newListProperty(GoAddr *addr, intptr_t reflectIndex, intptr_t
void internalLogHandler(QtMsgType severity, const QMessageLogContext &context, const QString &text) void internalLogHandler(QtMsgType severity, const QMessageLogContext &context, const QString &text)
{ {
QByteArray textba = text.toUtf8(); QByteArray textba = text.toUtf8();
LogMessage message = {severity, textba.constData(), textba.size(), context.file, (int)strlen(context.file), context.line}; const int fileLength = context.file ? strlen(context.file) : 0;
LogMessage message = {severity, textba.constData(), textba.size(), context.file, fileLength, context.line};
hookLogHandler(&message); hookLogHandler(&message);
} }


Expand Down

0 comments on commit 154c0d1

Please sign in to comment.