diff options
author | Albert Safin <xzfcpw@gmail.com> | 2020-02-21 02:07:04 +0000 |
---|---|---|
committer | Albert Safin <xzfcpw@gmail.com> | 2020-02-21 02:07:04 +0000 |
commit | 83c7aff089a6728b6e522d934d656a8e09463112 (patch) | |
tree | 782ebb2f008b4ac6482f27a50072273820161ed8 /i3bar | |
parent | d3976fee8c5efb5b8544366f7b221c5cf08aa40c (diff) | |
download | i3-83c7aff089a6728b6e522d934d656a8e09463112.tar.gz i3-83c7aff089a6728b6e522d934d656a8e09463112.zip |
Limit workspace numbers within 0..INT32_MAX
Before this commit, large workspace numbers treated oddly:
$ i3-msg 'rename workspace to 1234567890'
# displayed in i3bar as `0`
$ i3-msg 'rename workspace to 4294967200'
$ i3-msg -t get_workspaces | jq '.[]|select(.focused).num'
-96 # int32_t overflow
$ i3-msg 'rename workspace to 99999999999999999999'
$ i3-msg -t get_workspaces | jq '.[]|select(.focused).num'
-1 # treated as unnumbered
This commit puts a consistent limit on workspace numbers. Now
workspaces with numbers beyond INT32_MAX are treated as unnumbered.
Diffstat (limited to 'i3bar')
-rw-r--r-- | i3bar/src/workspaces.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/i3bar/src/workspaces.c b/i3bar/src/workspaces.c index 5b43c4a0..68686611 100644 --- a/i3bar/src/workspaces.c +++ b/i3bar/src/workspaces.c @@ -114,7 +114,7 @@ static int workspaces_string_cb(void *params_, const unsigned char *val, size_t if ((config.strip_ws_numbers || config.strip_ws_name) && params->workspaces_walk->num >= 0) { /* Special case: strip off the workspace number/name */ - static char ws_num[10]; + static char ws_num[32]; snprintf(ws_num, sizeof(ws_num), "%d", params->workspaces_walk->num); |