Commit graph

17 commits

Author SHA1 Message Date
Alan Coopersmith
bbf3c582c9 Use strdup() instead of malloc(strlen())+strcpy()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-10-18 10:24:13 -07:00
Alan Coopersmith
8f677eaea0 signedness bug & integer overflow in _XcursorFileHeaderCreate() [CVE-2013-2003]
When parsing cursor files, a user defined (e.g. through environment
variables) cursor file is opened and parsed.

The header is read in _XcursorReadFileHeader(), which reads an unsigned
int for the number of toc structures in the header, but it was being
passed to _XcursorFileHeaderCreate() as a signed int to allocate those
structures.  If the number was negative, it would pass the bounds check
and could overflow the calculation for how much memory to allocate to
store the data being read, leading to overflowing the buffer with the
data read from the user controlled file.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-04-26 17:22:43 -07:00
Alan Coopersmith
2b8d373bdd XcursorFileSaveImages: plug memory leak on invalid input
Error: Memory leak (CWE 401)
   Memory leak of pointer 'comments' allocated with XcursorCommentsCreate(0)
        at line 982 of src/file.c in function 'XcursorFileSaveImages'.
          'comments' allocated at line 978 with XcursorCommentsCreate(0).
          comments leaks when comments != 0 at line 981.

[ This bug was found by the Parfait 0.3.7 bug checking tool.
  For more information see http://labs.oracle.com/projects/parfait/ ]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-30 18:59:33 -08:00
Alan Coopersmith
e086eb1bf4 Strip trailing whitespace
Performed with: find * -type f | xargs perl -i -p -e 's{\s+$}{\n}'
git diff -w & git diff -b show no diffs from this change

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-09-16 21:26:17 -07:00
Chris Wilson
f49e7e1608 Free the partial header after failing to open the cursor.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-04-01 12:16:56 +01:00
Matthieu Herrb
04641d3cc3 nuke RCS Ids 2008-03-09 00:34:36 +01:00
Alan Coopersmith
9df9640643 Fix many sparse warnings: Using plain integer as NULL pointer 2006-10-10 14:57:16 -07:00
Chris Wilson
e0a501e91c fix leak in header destruction
Fix a couple of if (!foo) free(foo); tests.
2006-08-12 19:55:44 +03:00
Daniel Stone
c6f65af419 Bug #5268: Fix small memory leak. (Matthias Clasen). Change some return 0s
to NULL. Bump to 1.1.7.
2006-06-03 10:23:57 +00:00
Daniel Stone
caa910e492 Import Xcursor 1.1.4 from freedesktop.org xlibs tree. 2005-06-29 18:46:53 +00:00
Markus Kuhn
50911b052c Encoding of numerous files changed to UTF-8 2004-12-04 00:42:47 +00:00
Egbert Eich
cbcf471d91 Merging XORG-CURRENT into trunk 2004-04-23 18:43:40 +00:00
Egbert Eich
fb1739bd22 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 2004-03-14 08:32:05 +00:00
Egbert Eich
bfcfbe061f Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 2004-03-03 12:11:23 +00:00
Egbert Eich
c450b74503 readding XFree86's cvs IDs 2004-02-26 13:35:32 +00:00
Egbert Eich
79b8e8b996 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 2004-02-26 09:22:42 +00:00
Kaleb Keithley
3b84b14bf0 Initial revision 2003-11-14 16:48:48 +00:00