diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-09-30 16:04:29 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-09-30 16:04:29 -0700 |
commit | 31f1f355700870c6615399fbfa7934934b3a9a57 (patch) | |
tree | 1d0bef3eca04a2a3fe7917d8450fa7c486be70f0 /src/xkbcomp | |
parent | c9a499c9c9b8aec88c8ba1a1f58fb86c3bb15d5d (diff) | |
download | xorg-lib-libxkbcommon-31f1f355700870c6615399fbfa7934934b3a9a57.tar.gz |
Fix off-by-one error in index check in xkb_file_type_to_string
Found by Oracle's Parfait 2.2 static analyzer:
Error: Buffer overrun
Read outside array bounds [read-outside-array-bounds] (CWE 125):
In array dereference of xkb_file_type_strings[type] with index type
Array size is 56 bytes, index <= 56
at line 734 of src/xkbcomp/ast-build.c in function 'xkb_file_type_to_string'.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/xkbcomp')
-rw-r--r-- | src/xkbcomp/ast-build.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/xkbcomp/ast-build.c b/src/xkbcomp/ast-build.c index 2de9e61..365ff51 100644 --- a/src/xkbcomp/ast-build.c +++ b/src/xkbcomp/ast-build.c @@ -729,7 +729,7 @@ static const char *xkb_file_type_strings[_FILE_TYPE_NUM_ENTRIES] = { const char * xkb_file_type_to_string(enum xkb_file_type type) { - if (type > _FILE_TYPE_NUM_ENTRIES) + if (type >= _FILE_TYPE_NUM_ENTRIES) return "unknown"; return xkb_file_type_strings[type]; } |