commit 0d51a082e78ca698c390f0eca62e24e1ae0873fd
parent d3f3619c3aed03ddd70afee41cb941320a551ed8
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 2 May 2016 08:13:21 -0400
Merge pull request #630 from 1ace/fix/obob
Fix off-by-one bug in log functions
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git 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;
}