summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2015-04-06 16:18:22 +0200
committerUli Schlachter <psychon@znc.in>2015-04-06 16:18:22 +0200
commitac6b8d89120c9c26925fa4c9bc5d8b56d4ef7113 (patch)
treeb20715ecd1b78b5a54036addcc9905f863496c31 /src
parent54e2145e1198a892312c571098298baa56fb4d05 (diff)
Re-add a missing length check
This check was accidentally removed in commit 4ed12c46dec9a3055e009c5ecd6c. Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src')
-rw-r--r--src/xcb_errors.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/xcb_errors.c b/src/xcb_errors.c
index 428e7be..2eedc34 100644
--- a/src/xcb_errors.c
+++ b/src/xcb_errors.c
@@ -200,7 +200,8 @@ const char *xcb_errors_get_name_for_core_event(xcb_errors_context_t *ctx,
best = current;
}
- if (best == NULL || best->first_event == 0) {
+ if (best == NULL || best->first_event == 0
+ || event_code - best->first_event >= best->static_info->num_events) {
/* Nothing found */
return get_strings_entry(xproto_info.strings_events, event_code);
}
@@ -237,7 +238,8 @@ const char *xcb_errors_get_name_for_error(xcb_errors_context_t *ctx,
best = current;
}
- if (best == NULL || best->first_error == 0) {
+ if (best == NULL || best->first_error == 0
+ || error_code - best->first_error >= best->static_info->num_errors) {
/* Nothing found */
return get_strings_entry(xproto_info.strings_errors, error_code);
}