summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2020-05-24 17:14:12 +0200
committerDave Davenport <qball@gmpclient.org>2020-05-24 17:14:12 +0200
commit0e880e76a21969f42ee3cd764a459f0d504c5a57 (patch)
treecd648a0cfdb860f164fa0257e7c7e3cf4246d8b4
parent135ff94a797888a7a7f8d43c125b770e3bc8ac76 (diff)
[Window] On window name list, Check if we go out of range.
-rw-r--r--source/dialogs/window.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/dialogs/window.c b/source/dialogs/window.c
index e5eb33cb..5762ca9a 100644
--- a/source/dialogs/window.c
+++ b/source/dialogs/window.c
@@ -453,6 +453,7 @@ static unsigned int window_mode_get_num_entries ( const Mode *sw )
* Small helper function to find the right entry in the ewmh reply.
* Is there a call for this?
*/
+const char *invalid_desktop_name = "n/a";
static const char * _window_name_list_entry ( const char *str, uint32_t length, int entry )
{
uint32_t offset = 0;
@@ -463,6 +464,9 @@ static const char * _window_name_list_entry ( const char *str, uint32_t length,
}
offset++;
}
+ if ( offset >= length ){
+ return invalid_desktop_name;
+ }
return &str[offset];
}
static void _window_mode_load_data ( Mode *sw, unsigned int cd )