xorg-libx11/modules/im/ximcp
Michal Srb a9dafdd57c Use flexible array member instead of fake size.
The _XimCacheStruct structure is followed in memory by two strings containing
fname and encoding. The memory was accessed using the last member of the
structure `char fname[1]`. That is a lie, prohibits us from using sizeof and
confuses checkers. Lets declare it properly as a flexible array, so compilers
don't complain about writing past that array. As bonus we can replace the
XOffsetOf with regular sizeof.

Fixes GCC8 error:
  In function 'strcpy',
      inlined from '_XimWriteCachedDefaultTree' at imLcIm.c:479:5,
      inlined from '_XimCreateDefaultTree' at imLcIm.c:616:2,
      inlined from '_XimLocalOpenIM' at imLcIm.c:700:5:
  /usr/include/bits/string_fortified.h:90:10: error: '__builtin_strcpy'
  forming offset 2 is out of the bounds [0, 1] [-Werror=array-bounds]
     return __builtin___strcpy_chk (__dest, __src, __bos (__dest));

Caused by this line seemingly writing past the fname[1] array:
  imLcIm.c:479:  strcpy (m->fname+strlen(name)+1, encoding);

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-23 14:32:05 +10:00
..
imCallbk.c fix more shadow warning 2017-08-14 18:12:35 +02:00
imDefFlt.c XIM: remove Private and Public macros 2012-10-29 18:43:35 -05:00
imDefIc.c remove argument check for free() adjust one inden 2017-08-14 18:02:40 +02:00
imDefIm.c Remove more redundant null checks before Xfree() 2014-06-06 17:24:39 -07:00
imDefLkup.c Remove more redundant null checks before Xfree() 2014-06-06 17:24:39 -07:00
imDispch.c Remove even more casts of return values from Xmalloc/Xrealloc 2013-08-20 12:51:09 -07:00
imEvToWire.c Purge macros NEED_EVENTS and NEED_REPLIES 2010-07-07 15:12:34 -07:00
imExten.c Get rid of some extraneous ; at the end of C source lines 2015-10-19 13:52:20 -04:00
imImSw.c XIM: remove Private and Public macros 2012-10-29 18:43:35 -05:00
imInsClbk.c Remove even more casts of return values from Xmalloc/Xrealloc 2013-08-20 12:51:09 -07:00
imInt.c Remove more redundant null checks before Xfree() 2014-06-06 17:24:39 -07:00
imLcFlt.c XIM: Allow modifier releases in compose sequences (#26705) 2011-12-11 16:56:06 -05:00
imLcGIc.c XIM: remove Private and Public macros 2012-10-29 18:43:35 -05:00
imLcIc.c Remove even more casts of return values from Xmalloc/Xrealloc 2013-08-20 12:51:09 -07:00
imLcIm.c Use flexible array member instead of fake size. 2018-03-23 14:32:05 +10:00
imLcLkup.c fix more shadow warning 2017-08-14 18:12:35 +02:00
imLcPrs.c Fix an indentation issue 2015-05-18 07:56:22 +10:00
imLcSIc.c XIM: remove Private and Public macros 2012-10-29 18:43:35 -05:00
imRm.c Remove even more casts of return values from Xmalloc/Xrealloc 2013-08-20 12:51:09 -07:00
imRmAttr.c Remove more redundant null checks before Xfree() 2014-06-06 17:24:39 -07:00
imThaiFlt.c XIM: remove Private and Public macros 2012-10-29 18:43:35 -05:00
imThaiIc.c Remove more redundant null checks before Xfree() 2014-06-06 17:24:39 -07:00
imThaiIm.c Remove unnecessary casts of pointers to (char *) in calls to Xfree() 2013-08-20 12:51:09 -07:00
imTrans.c Remove even more casts of return values from Xmalloc/Xrealloc 2013-08-20 12:51:09 -07:00
imTransR.c Remove even more casts of return values from Xmalloc/Xrealloc 2013-08-20 12:51:09 -07:00
imTrX.c Remove even more casts of return values from Xmalloc/Xrealloc 2013-08-20 12:51:09 -07:00
Makefile.am integer overflows in TransFileName() [CVE-2013-1981 9/13] 2013-05-09 18:59:52 -07:00