all repos — fluxbox @ 5f958b3bd5c33282ab5b772854d96d4d2a6b72e6

custom fork of the fluxbox windowmanager

check for errno while parsing the deco mask
Mathias Gumz akira at fluxbox dot org
commit

5f958b3bd5c33282ab5b772854d96d4d2a6b72e6

parent

6a37a047eb6dab60b914ac8177a5c4f73f1a108f

1 files changed, 9 insertions(+), 4 deletions(-)

jump to
M src/WindowState.ccsrc/WindowState.cc

@@ -23,7 +23,8 @@ #include "WindowState.hh"

#include "FbTk/StringUtil.hh" -#include <stdlib.h> +#include <cstdlib> +#include <errno.h> bool WindowState::useBorder() const { return !fullscreen && maximized != MAX_FULL && deco_mask & DECORM_BORDER;

@@ -92,10 +93,14 @@ if (label == "border")

return DECOR_BORDER; if (label == "tab") return DECOR_TAB; + int mask = -1; - if ((str_label.size() > 1 && str_label[0] == '0' && str_label[1] == 'x') || - (str_label.size() > 0 && isdigit(str_label[0]))) - mask = strtol(str_label.c_str(), NULL, 0); + int tmp; + errno = 0; + tmp = strtol(str_label.c_str(), NULL, 0); + if (errno == 0) + mask = tmp; + return mask; }