diff options
author | 2016-05-02 08:13:21 -0400 | |
---|---|---|
committer | 2016-05-02 08:13:21 -0400 | |
commit | 0d51a082e78ca698c390f0eca62e24e1ae0873fd (patch) | |
tree | e384d5991656adf8424b3942bd034d0e86c65a3a /common | |
parent | Merge pull request #627 from mikkeloscar/update-title-when-tabbed (diff) | |
parent | Fix off-by-one bug in log functions (diff) | |
download | sway-0d51a082e78ca698c390f0eca62e24e1ae0873fd.tar.gz sway-0d51a082e78ca698c390f0eca62e24e1ae0873fd.tar.zst sway-0d51a082e78ca698c390f0eca62e24e1ae0873fd.zip |
Merge pull request #630 from 1ace/fix/obob
Fix off-by-one bug in log functions
Diffstat (limited to 'common')
-rw-r--r-- | common/log.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/log.c b/common/log.c index 6d958db2..c68f0516 100644 --- a/common/log.c +++ b/common/log.c | |||
@@ -68,7 +68,7 @@ void _sway_log(log_importance_t verbosity, const char* format, ...) { | |||
68 | #endif | 68 | #endif |
69 | if (verbosity <= v) { | 69 | if (verbosity <= v) { |
70 | unsigned int c = verbosity; | 70 | unsigned int c = verbosity; |
71 | if (c > sizeof(verbosity_colors) / sizeof(char *)) { | 71 | if (c > sizeof(verbosity_colors) / sizeof(char *) - 1) { |
72 | c = sizeof(verbosity_colors) / sizeof(char *) - 1; | 72 | c = sizeof(verbosity_colors) / sizeof(char *) - 1; |
73 | } | 73 | } |
74 | 74 | ||
@@ -96,7 +96,7 @@ void _sway_log(log_importance_t verbosity, const char* format, ...) { | |||
96 | void sway_log_errno(log_importance_t verbosity, char* format, ...) { | 96 | void sway_log_errno(log_importance_t verbosity, char* format, ...) { |
97 | if (verbosity <= v) { | 97 | if (verbosity <= v) { |
98 | unsigned int c = verbosity; | 98 | unsigned int c = verbosity; |
99 | if (c > sizeof(verbosity_colors) / sizeof(char *)) { | 99 | if (c > sizeof(verbosity_colors) / sizeof(char *) - 1) { |
100 | c = sizeof(verbosity_colors) / sizeof(char *) - 1; | 100 | c = sizeof(verbosity_colors) / sizeof(char *) - 1; |
101 | } | 101 | } |
102 | 102 | ||