summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix spelling/wording issuesAlan Coopersmith2022-07-175-9/+9
| | | | | | | Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* parse: simplify error paths in xpmParseColors()Benjamin Tissoires2019-12-061-26/+24
| | | | | | | We introduced a new label to handle the errors, we should use it for the rest of the function. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
* parse: avoid memleak on error with STRLCAT/STRLCPYPeter Hutterer2019-12-061-20/+58
| | | | | | | | | The original macro might exit the function without freeing `colorTable`. Move the macros into a slightly less awful helper function and use goto to clean up in case of error. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* After fdopen(), use fclose() instead of close() in error pathAlan Coopersmith2018-10-061-1/+1
| | | | | | | | | | | | | | | | | Found by Oracle's Parfait 2.2 static analyzer: Error: File Leak File Leak [file-ptr-leak]: Leaked File fp at line 94 of lib/libXpm/src/RdFToBuf.c in function 'XpmReadFileToBuffer '. fp initialized at line 86 with fdopen fp leaks when len < 0 at line 92. Introduced-by: commit 8b3024e6871ce50b34bf2dff924774bd654703bc Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* Windows build fixesDave Bodenstab2018-09-224-0/+19
| | | | | | | https://bugs.freedesktop.org/show_bug.cgi?id=46475 https://bugs.freedesktop.org/attachment.cgi?id=57479 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Handle size_t in file/buffer lengthTobias Stoeckmann2016-12-122-1/+5
| | | | | | | | The values of file sizes and buffer sizes can exceed current limits. Therefore, use proper variable types for these operations. Signed-off-by: Matthieu Herrb <matthieu@herrb.eu> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
* Avoid OOB write when handling malicious XPM files.Tobias Stoeckmann2016-12-121-9/+25
| | | | | | | | | | | | | | | | | libXpm uses unsigned int to store sizes, which fits size_t on 32 bit systems, but leads to issues on 64 bit systems. On 64 bit systems, it is possible to overflow 32 bit integers while parsing XPM extensions in a file. At first, it looks like a rather unimportant detail, because nobody will seriously open a 4 GB file. But unfortunately XPM has support for gzip compression out of the box. An attacker can therefore craft a compressed file which is merely 4 MB in size, which makes an attack much for feasable. Signed-off-by: Matthieu Herrb <matthieu@herrb.eu> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
* Gracefully handle EOF while parsing files.Tobias Stoeckmann2016-12-121-8/+32
| | | | | | | | | | | | | | | | | libXpm does not properly handle EOF conditions when xpmGetC is called multiple times in a row to construct a string. Instead of checking its return value for EOF, the result is automatically casted into a char and attached to a string. By carefully crafting the color table in an XPM file, it is possible to send a libXpm program like gimp into a very long lasting loop and massive memory allocations. Otherwise no memory issues arise, therefore this is just a purely functional patch to dismiss invalid input. Signed-off-by: Matthieu Herrb <matthieu@herrb.eu> Reviewed-by: Matthieu Herrb <Matthieu@herrb.eu>
* Fix out out boundary read on unknown colorsTobias Stoeckmann2016-12-121-1/+2
| | | | | | | | | | | | libXpm is vulnerable to an out of boundary read if an XPM file contains a color with a symbolic name but without any default color value. A caller must set XpmColorSymbols and a color with a NULL name in the supplied XpmAttributes to XpmReadFileToImage (or other functions of this type) in order to trigger this issue. Signed-off-by: Matthieu Herrb <matthieu@herrb.eu> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
* Fix abs() usage.Jörg Sonnenberger2014-03-191-4/+4
| | | | | | | For long arguments, use labs(). Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
* Fix libXpm build with NO_ZPIPEClaudio Bley2013-05-311-1/+2
| | | | | | | | | | | When NO_ZPIPE is defined, fcntl.h is not included in WrFFrI.c although OpenWriteFile uses open, O_WRONLY, O_CREAT and O_TRUNC. * src/WrFFrI.c: unconditionally include fcntl.h regardless of NO_ZPIPE being defined or not. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Added 'const' attribute to all filename arguments in the APIChristophe CURIS2013-05-318-10/+10
| | | | | | | | | | | | | | The filename is always a read-only argument, so it is a good idea to let the caller now about it. This patch does not change active code; the place where the attribute is added will not break source-level compatibility because it adds no restriction on caller side, just adds information; because the lib code behaved the same way it will not break the binary interface either. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Added 'const' qualifier to the filename argument to internal functionsChristophe CURIS2013-05-312-4/+4
| | | | | Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Close fd if fdopen() or xpmPipeThrough() fails in OpenWriteFile()Alan Coopersmith2013-04-231-1/+3
| | | | | | | | | | | | Fixes leak found by parfait 1.1 bug checking tool: File Descriptor Leak: Leaked File Descriptor fd at line 350 of lib/libXpm/src/WrFFrI.c in function 'OpenWriteFile'. fd initialized at line 332 with open fd leaks when strcmp(".Z", (filename + (len - 2))) != 0 at line 337 and strcmp(".gz", (filename + (len - 3))) != 0 at line 340. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
* closeness_cmp: maintain constness when casting pointersAlan Coopersmith2011-11-181-1/+1
| | | | | | | | create.c: In function 'closeness_cmp': create.c:224:5: warning: cast discards qualifiers from pointer target type create.c:224:5: warning: cast discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Include missing headersJeremy Huddleston2011-11-111-0/+2
| | | | | | This fixes implicit declarations for strdup and strcasecmp. Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
* Fix gcc -Wwrite-strings warnings that don't require public API changesAlan Coopersmith2011-11-105-18/+23
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Assume C89 and just use const, not local Const macroAlan Coopersmith2011-11-103-11/+5
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Strip trailing whitespaceAlan Coopersmith2011-09-1612-76/+76
| | | | | | | Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* config: provide a Makefile for the include directoryGaetan Nadon2010-10-241-3/+0
| | | | | | | Reduce some complexity in the src makefile as it should not handle sibling directories. Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
* libXpm make: remove redundant -I.Gaetan Nadon2010-10-241-1/+1
| | | | | | It is always included by Automake Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
* Missing end comment in libXpm/src/parse.cColin Harrison2010-10-071-0/+1
| | | | | | CVS tag removal chopped too much out in this case... Signed-off-by: Julien Cristau <jcristau@debian.org>
* Purge cvs tags.Jesse Adkins2010-10-069-14/+0
| | | | | Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONSAlan Coopersmith2009-10-081-1/+1
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
* Janitor: ansification, make distcheck, .gitignorePaulo Cesar Pereira de Andrade2009-01-3029-650/+616
| | | | | | The ansification code is minor edit of the patch (by me) at https://bugs.freedesktop.org/show_bug.cgi?id=14727 as it would not apply cleanly anymore.
* Replace strcpy with strncpy to match previous code blockAlan Coopersmith2007-08-221-1/+2
|
* Replace index/rindex with C89 standard strchr/strrchrAlan Coopersmith2007-08-063-8/+8
|
* X.Org Bug #11863: Build libXpm on MS Windows (with MinGW)Jason Rumney2007-08-063-1/+24
| | | | | | | | | | | * src/XpmI.h [FOR_MSW]: Include simx.h instead of real X headers. * src/simx.h (_XFUNCPROTOBEGIN, _XFUNCPROTOEND, NO_ZPIPE): Define. (XAllocColor): Fix arg list in prototype. (bzero, close, fdopen, index, rindex, open, strdup, O_RDONLY): Map to W32 equivalents. * src/RdFToI.c [FOR_MSW]: Include fcntl.h.
* Use AM_CFLAGS & AM_CPPFLAGS to replace per-program and obsolete macrosAlan Coopersmith2007-06-271-3/+2
| | | | Clears some warnings from automake-1.10
* renamed: .cvsignore -> .gitignoreAlan Coopersmith2006-07-131-0/+0
|
* Always initialize atomTable to NULL, so xpmHashTableFree() doesn't try toAlan Coopersmith2006-06-031-0/+1
| | | | | free a random value from the stack if xpmHashTableInit returns an error.
* Coverity #1432: Returned without freeing storage "hints_cmt" (in error caseAlan Coopersmith2006-06-021-3/+3
| | | | when xpmHashTableInit failed)
* Coverity #1415: Returned without freeing storage "hints_cmt" (in error caseAlan Coopersmith2006-06-021-3/+3
| | | | when xpmHashTableInit failed)
* doublecheck that a pointer is not NULL before dereferencing it. (CoverityXORG-7_0_99_901Matthieu Herrb2006-03-181-1/+1
| | | | CID 121).
* Add missing files to EXTRA_DISTKevin E Martin2005-10-051-2/+3
| | | | Fix man page installation
* Last argument of variable parameter list needs to be casted to a pointerXORG-6_8_99_903XORG-6_8_99_902XORG-6_8_99_901Matthieu Herrb2005-10-031-1/+1
| | | | type.
* Accept autoconf HAVE_STRLCPY as alias for HAS_STRLCATXORG-6_8_99_900XORG-6_8_99_16Alan Coopersmith2005-07-161-1/+1
|
* Set soversion to 4.11.0 with -version-number.Daniel Stone2005-07-161-1/+1
|
* Add .cvsignore filesKeith Packard2005-07-091-0/+6
|
* - Add build system for lib/XpmXORG-6_8_99_9XORG-6_8_99_8XORG-6_8_99_15XORG-6_8_99_14XORG-6_8_99_13XORG-6_8_99_12XORG-6_8_99_11XORG-6_8_99_10Søren Sandmann Pedersen2005-05-1931-0/+136
| | | | | - Add Xpm to symlink.sh - Conditionally include config.h in xc/extras/Xpm
* Avoid inifite loops. From Chris Gilbert in bug #1920.sco_port_update-baseXORG-6_8_99_7XORG-6_8_99_6XORG-6_8_99_5XORG-6_8_99_4XORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_1sco_port_updateMatthieu Herrb2005-02-212-5/+8
|
* Fix incomplete merge.Matthieu Herrb2004-12-111-11/+2
|
* more s_open() cleanup.Matthieu Herrb2004-12-111-6/+0
|
* Replace s_popen() by a more specific function that allows only one commandMatthieu Herrb2004-12-112-124/+150
| | | | | in the pipe. Remove extraneous tests on file names that broke some applications. From Alex Reisen in Bugzilla #1920.
* Fixes for CAN-2004-0914 (Thomas Biege).Matthieu Herrb2004-11-2514-156/+352
|
* Merged over libXpm security fix provided by Chris Evans, Matthieu Herrb andEgbert Eich2004-09-219-24/+113
| | | | | | | | | | | | | Alan Coopersmith from release 6.8.1. Fail during initialization with error if font/fontset is not set for widget. This prevents a sig11 later when the non-existent font/fontset structs are referenced. Check if xf86Info.kbdProc pointer is really set before calling it on abort as this pointer won't be set if the new modular keyboard driver is used (Matthias Hopf). Added new libs to the bindist control files. Removed inclusion of unnecessary kernel header on Linux. This may fail in an -ansi environment.
* Merging XORG-CURRENT into trunkrel-0-6-1lg3d-rel-0-7-0lg3d-baseXORG-6_8_0XORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2XORG-6_7_99_1XACE-SELINUX-MERGElg3d-eventlg3d-dev-0-6-latestlg3d-dev-0-6-1-latestlg3d-dev-0-6-1-currentlg3dCOMPOSITEWRAPEgbert Eich2004-04-239-10/+10
|
* Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich2004-03-149-10/+10
|
* Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0STSF-CURRENTEgbert Eich2004-03-039-10/+10
|
* readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich2004-02-269-10/+10
|