diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2016-05-02 08:13:21 -0400 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2016-05-02 08:13:21 -0400 |
| commit | 553e9ff47e7cb7b2a1c20bd797f5fb57efa5f45f (patch) | |
| tree | e384d5991656adf8424b3942bd034d0e86c65a3a | |
| parent | 137d474dea74a6b92040da3f70b6a9ad1e7d7b3e (diff) | |
| parent | 065db11757ab7ceece3b79f883f8450df909dddb (diff) | |
Merge pull request #630 from 1ace/fix/obob
Fix off-by-one bug in log functions
| -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, ...) { #endif if (verbosity <= v) { unsigned int c = verbosity; - if (c > sizeof(verbosity_colors) / sizeof(char *)) { + if (c > sizeof(verbosity_colors) / sizeof(char *) - 1) { c = sizeof(verbosity_colors) / sizeof(char *) - 1; } @@ -96,7 +96,7 @@ void _sway_log(log_importance_t verbosity, const char* format, ...) { void sway_log_errno(log_importance_t verbosity, char* format, ...) { if (verbosity <= v) { unsigned int c = verbosity; - if (c > sizeof(verbosity_colors) / sizeof(char *)) { + if (c > sizeof(verbosity_colors) / sizeof(char *) - 1) { c = sizeof(verbosity_colors) / sizeof(char *) - 1; } |
