Skip to content

Commit 38309d1

Browse files
committed
Check printf format string and arguments
1 parent 4ef5bf0 commit 38309d1

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

hardware/EvohomeBase.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,11 @@ class CEvohomeBase : public CDomoticzHardwareBase
516516
static const char* GetZoneModeName(uint8_t nZoneMode);
517517

518518
static void LogDate();
519-
static void Log(bool bDebug, int nLogLevel, const char* format, ... );
519+
static void Log(bool bDebug, int nLogLevel, const char* format, ... )
520+
#ifdef __GNUC__
521+
__attribute__ ((format (printf, 3, 4)))
522+
#endif
523+
;
520524
static void Log(const char *szMsg, CEvohomeMsg &msg);
521525

522526
private:

main/Logger.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,17 @@ class CLogger
6262
void SetOutputFile(const char *OutputFile);
6363

6464
void Log(const _eLogLevel level, const std::string& sLogline);
65-
void Log(const _eLogLevel level, const char* logline, ...);
65+
void Log(const _eLogLevel level, const char* logline, ...)
66+
#ifdef __GNUC__
67+
__attribute__ ((format (printf, 3, 4)))
68+
#endif
69+
;
6670
void Debug(const _eDebugLevel level, const std::string& sLogline);
67-
void Debug(const _eDebugLevel level, const char* logline, ...);
68-
71+
void Debug(const _eDebugLevel level, const char* logline, ...)
72+
#ifdef __GNUC__
73+
__attribute__ ((format (printf, 3, 4)))
74+
#endif
75+
;
6976
void LogSequenceStart();
7077
void LogSequenceAdd(const char* logline);
7178
void LogSequenceAddNoLF(const char* logline);

0 commit comments

Comments
 (0)