aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
Commit message (Collapse)AuthorAgeFilesLines
* NXdixfonts.c: Regression fix for db45683a. Fix typo in libXfont1 function ↵Mike Gabriel2020-11-041-1/+1
| | | | call (FreeFontName -> FreeFontNames). Fixes FTBFS on Ubuntu 14.04 and 16.04.
* NXdixfonts.c: Hard-code the enablement of NXAGENT_DANGEROUS_XFONT_LOOP_EXIT.Mike Gabriel2020-11-031-0/+7
|
* NXdixfonts.c: Rename BREAK_XFONT_LOOP to NXAGENT_DANGEROUS_XFONT_LOOP_EXIT ↵Mike Gabriel2020-11-031-4/+4
| | | | (better macro name).
* NXdixfonts.c: fix memory leakUlrich Sibiller2020-11-031-6/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ==15332== 2,500 (96 direct, 2,404 indirect) bytes in 6 blocks are definitely lost in loss record 324 of 342 ==15332== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==15332== by 0x5748B9E: FontFileStartListFonts (in /usr/lib/x86_64-linux-gnu/libXfont.so.1.4.1) ==15332== by 0x5748C4A: FontFileStartListFontsAndAliases (in /usr/lib/x86_64-linux-gnu/libXfont.so.1.4.1) ==15332== by 0x42859A: nxdoListFontsAndAliases (NXdixfonts.c:1163) ==15332== by 0x42C0E0: nxOpenFont (NXdixfonts.c:1541) ==15332== by 0x43392E: ProcOpenFont (NXdispatch.c:902) ==15332== by 0x434585: Dispatch (NXdispatch.c:482) ==15332== by 0x40EF77: main (main.c:355) FontFileStartListFonts[AndAliases]() allocates some private data. This data is used by subsequent calls of FontFileListNextFontOrAlias() in a loop. (Only) the last call to that function will free() the private data and return with BadFontName. FontFileListNextFontOrAlias() is the only libXfont function that free()s the private data. In nxagent the loop is exited as soon as a font exists both locally and remote. Therefore the private data would never be free()d. Solution: do not break the loop but store the first matching result and let the loop run to the end, ignoring all following results. Disadvantage: this can mean hundreds of extra iterations for nothing. I have done no investigation of the time penalty this might cause. Unfortunately this is the only clean way I have found so far. An unclean solution has also been implemented. It can be activated by defining BREAK_XFONT_LOOP. In that case the private data is handled in nxagent by taking assumptions about its structure (taken from the libXfont source). That will break if libXfont changes its internal handling of the private. Therefore it is discouraged. An third alternative would be to drop using libXfont from the system. Instead fork libXfont to the nx-libs tree, add some patches link to that library statically. Fixes ArcticaProject/nx-libs#586
* NXdixfonts.c: some code cleanupsUlrich Sibiller2020-05-071-18/+16
| | | | reformat, extend comments, simplify ifdef
* NXdixfonts.c: fix debugging outputUlrich Sibiller2020-05-071-1/+5
|
* Font.c: add hint of deliberate pointer misuseUlrich Sibiller2020-05-071-3/+4
|
* NXdixfonts.c: mark NX changesUlrich Sibiller2020-05-071-52/+107
| | | | | Also add original code to make NX changes obvious. Also change some lines to match original code.
* NXdixfonts.c: drop NXAGENT_DEBUGUlrich Sibiller2020-05-071-35/+35
| | | | | | | and use DEBUG like everywhere else. There were already some TEST lines using this scheme. Also indent DEBUG and TEST lines to make the code more readable
* NXdixfonts.c: call dix version of SetDefaultFontPathUlrich Sibiller2020-05-071-71/+2
|
* NXdixfonts.c: use NXAGENT_SERVER instead of NX_TRANS_SOCKUlrich Sibiller2019-09-291-15/+7
| | | | | that macro fits better here since there's no transport specific code.
* NXdixfonts.c: fix index out of boundsUlrich Sibiller2019-06-221-2/+2
|
* NXdixfonts.c: free() can handle NULLUlrich Sibiller2018-07-031-13/+10
| | | | so let's remove some superflous tests
* NXdixfonts.c: use calloc for LFclosurePtrUlrich Sibiller2018-07-031-1/+1
| | | | Just to be sure. It is used at lots of locations afterwards.
* Fix some valgrind findingsUlrich Sibiller2018-07-031-5/+3
| | | | | | Some of them have not been seen in the wild yet. Partly fixes ArcticaProject/nx-libs#711
* Replace hardcoded string lengths by macrosUlrich Sibiller2018-01-071-4/+5
|
* Dialog.c,Display.c,NXdixfonts.c: replace strncpy() by snprintf where appropriateUlrich Sibiller2018-01-071-3/+2
|
* Dialog.c,Display.c,Font.c,NXdixfonts.c: don't use hardcoded string buffer ↵Ulrich Sibiller2018-01-071-4/+4
| | | | lengths
* Xserver: Support building against libXfont2 (v2) API and old libXfont(1) API ↵Mike Gabriel2017-04-101-1/+105
| | | | | | | | | | | | | | | | | | | | | | | | alike. Fixes ArcticaProject/nx-libs#296. Inspired by the following X.org commit. Other than X.org, we will continue support for building nx-libs against libXfont1 for a while. commit 05a793f5b3c40747d5a92a076def7f4fb673c7e7 Author: Keith Packard <keithp@keithp.com> Date: Tue Sep 1 18:50:55 2015 -0700 dix: Switch to the libXfont2 API (v2) This new libXfont API eliminates exposing internal X server symbols to the font library, replacing those with a struct full of the entire API needed to use that library. v2: Use libXfont2 instead of libXfont_2 Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
* replace (DE)ALLOCATE_LOCAL by malloc/freeUlrich Sibiller2017-03-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | This is basically a backport of the following commits + replacing xalloc/xfree by malloc/free. Fixes ArcticaProject/nx-libs#358. commit 2761c103311a1160bc483fd0367d654733df8598 Author: Daniel Stone <daniel@fooishbar.org> Date: Mon Nov 5 14:03:26 2007 +0000 OS: Remove usage of alloca Replace with heap allocations. commit 5e363500c86042c394595e1a6633581eb8fcd1bb Author: Daniel Stone <daniel@fooishbar.org> Date: Mon Nov 5 14:38:28 2007 +0000 OS: Remove ALLOCATE_LOCAL from os.h Remove ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK from os.h, and remove the include of Xalloca.h as well.
* {dix/,hw/nxagent/NX}dixfont.{c,h}: Support using builtin-fonts. Makes ↵Mike Gabriel2017-02-271-11/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dependency on X11's misc fonts package obsolete. This backports a mixture of these X.org commits (only focusing on SetDefaultFontPath() function): commit 03e8bfa1d122f7dea905d48c93cfd54afd991dfd Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Sat Nov 27 20:09:04 2010 -0800 Convert existing Xprintf style calls to asprintf style Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net> commit 12e46e83733b47d2704e1509960192365102af46 Author: Tiago Vignatti <tiago.vignatti@nokia.com> Date: Fri Mar 25 22:07:31 2011 +0200 dix: fix memory leak in SetDefaultFontPath Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> commit 6592db6bb526f0c43b4c7b55859c629709e039b4 Author: Mikhail Gusarov <dottedmag@dottedmag.net> Date: Fri Jun 4 16:58:58 2010 +0700 Get rid of xstrdup when argument is definitely non-NULL Replace xstrdup with strdup when either constant string is being duplicated or argument is guarded by conditionals and obviously can't be NULL Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> commit f56cbe1ef24415d0142b9a7d0ab0a031069ccb52 Author: Rémi Cardona <remi@gentoo.org> Date: Mon Sep 14 17:09:59 2009 +0200 dix: append "built-ins" to the font path in SetDefaultFontPath 49b93df8a3002db7196aa3fc1fd8dca1c12a55d6 made the hard dependency on a "fixed" font go away but only Xorg could use the built-ins fonts by default. With this commit, all DDXs get "built-ins" appended to their FontPath, not just Xorg. Tested with Xorg, Xvfb and Xnest. Signed-off-by: Rémi Cardona <remi@gentoo.org> Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> commit 49b93df8a3002db7196aa3fc1fd8dca1c12a55d6 Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> Date: Wed Jan 7 19:37:03 2009 -0200 Default to use standard bitmap fonts, with builtins as fallback The builtin-fonts configure option was removed, as it at best should have been a runtime option. Instead, now it always register all "font path element" backends, and adds built-ins fonts at the end of the default font path. This should be a more reasonable solution, to "correct" the most common Xorg FAQ (could not open default font 'fixed'), and also don't break by default applications that use only the standard/historical X Font rendering. Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Fixes ArcticaProject/nx-libs#84. Fixes ArcticaProject/nx-libs#285.
* VCS info lines: Remove ancient X.org / XFree86 VCS info line from code files.Mike Gabriel2016-07-061-3/+0
| | | | | This has already been started while replacing copyright info in file headers and has now been completed with this commit.
* Per-file copyright notices: Update copyright information in file headers ↵Mike Gabriel2016-07-061-7/+15
| | | | that NoMachine placed there own copyright statement in.
* Remove unneccesary casts from WriteToClient callsAlan Coopersmith2016-07-051-2/+2
| | | | | | | | | | | | | | Casting return to (void) was used to tell lint that you intended to ignore the return value, so it didn't warn you about it. Casting the third argument to (char *) was used as the most generic pointer type in the days before compilers supported C89 (void *) (except for a couple places it's used for byte-sized pointer math). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org> Backport to nx-libs: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* nx-X11/programs/Xserver: Drop {X,x}realloc() macros, use realloc() instead.Mike Gabriel2016-07-021-2/+2
|
* nx-X11/programs/Xserver: Drop {X,x}alloc() macros, use malloc() instead.Mike Gabriel2016-07-021-14/+14
|
* nx-X11/programs/Xserver: Drop {X,x}free() macros, use free() instead.Mike Gabriel2016-07-021-45/+45
| | | | Fixes ArcticaProject/nx-libs#105
* hw/nxagent/NXdixfonts.c: Shrink file, drop duplicate code that can ↵Mike Gabriel2016-06-251-1395/+5
| | | | identically be found in dix/dixfonts.c. Also remove NX'ish code from dix/dixfonts.c.
* hw/nxagent/NXdixfonts.c: Fix implicit declaration for register_fpe_functions().Mike Gabriel2016-05-021-0/+2
|
* hw/nxagent/NXdixfonts.c: Don't include <X11/fonts/fontstruct.h>. No symbol ↵Mike Gabriel2016-05-021-1/+0
| | | | needed from that header file.
* Clear header file namespace separation (<X11/...> vs. <nx-X11/...>).Mike Gabriel2015-12-281-5/+5
| | | | | | | | | | | | | | | | | | | | In the process of building nxagent against more and more system-wide installed X.org libraries, we come to the limit of including structs from this (bundled nx-X11) and that (system-wide X.Org) library. This commit introduces a clear namespace separation of headers provided by nx-X11 and headers provided by X.Org. This approach is only temporary as we want to drop all nx-X11 bundled libraries from nx-libs. However, for a while we need to make this separation clear and also ship some reduced fake X.Org headers that avoid pulling in libX* and libNX_X* symbols at the same time. This patch has been tested on Debian jessie and unstable and requires no overall testing on various distros and distro versions, as we finally will drop all libNX_X* libraries and build against X.org's client libs. For now, this hack eases our development / cleanup process.
* Replace 'pointer' type with 'void *'Keith Packard2015-12-281-38/+38
| | | | | | | | | | This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer' is used throughout the X server for other things, and having duplicate names generates compiler warnings. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net> Rebased against NX: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* Backport: xserver: Avoid sending uninitialized padding data over the networkPeter Åstrand2015-07-021-0/+2
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Avoid use-after-free in dix/dixfonts.c: doImageText() [CVE-2013-4396] from ↵Mike DePaulo2015-05-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | xorg/Xserver http://lists.x.org/archives/xorg-announce/2013-October/002332.html Save a pointer to the passed in closure structure before copying it and overwriting the *c pointer to point to our copy instead of the original. If we hit an error, once we free(c), reset c to point to the original structure before jumping to the cleanup code that references *c. Since one of the errors being checked for is whether the server was able to malloc(c->nChars * itemSize), the client can potentially pass a number of characters chosen to cause the malloc to fail and the error path to be taken, resulting in the read from freed memory. Since the memory is accessed almost immediately afterwards, and the X server is mostly single threaded, the odds of the free memory having invalid contents are low with most malloc implementations when not using memory debugging features, but some allocators will definitely overwrite the memory there, leading to a likely crash. v2: Apply to NXdixfonts.c rather than dixfonts.c (Mike DePaulo)
* library clean-up: Don't build and link libXfont.a anymore. Use system's ↵pr/libxfont-cleanupMike Gabriel2015-04-221-16/+2
| | | | libXfont shared library and link dynamically.
* NXAGENT_UPGRADE code cleanup:Mike Gabriel2015-04-161-177/+99
| | | | | | | | | | | NX agent contains/ed two build trees. An old one (probably pre-3.x.y) and a "newer" one. The "newer" code tree used to become enabled by setting NXUpgradeAgentServer in nx-X11/config/cf/host.def to YES. As building the NXUpgradeAgentServer has been the default for years now, we drop all code that does not get used at build time for NXUpgradeAgentServer == YES (i.e., the code that belongs to the pre-3.x.y phase of NX agent).
* Imported nxagent-3.5.0-2.tar.gznxagent/3.5.0-2Reinhard Tartler2011-10-101-1/+1
| | | | | | | | Summary: Imported nxagent-3.5.0-2.tar.gz Keywords: Imported nxagent-3.5.0-2.tar.gz into Git repository
* Imported nxagent-3.4.0-5.tar.gznxagent/3.4.0-5Reinhard Tartler2011-10-101-1/+1
| | | | | | | | Summary: Imported nxagent-3.4.0-5.tar.gz Keywords: Imported nxagent-3.4.0-5.tar.gz into Git repository
* Imported nxagent-3.4.0-3.tar.gznxagent/3.4.0-3Reinhard Tartler2011-10-101-1/+1
| | | | | | | | Summary: Imported nxagent-3.4.0-3.tar.gz Keywords: Imported nxagent-3.4.0-3.tar.gz into Git repository
* Imported nxagent-3.4.0-16.tar.gznxagent/3.4.0-16Reinhard Tartler2011-10-101-1/+1
| | | | | | | | Summary: Imported nxagent-3.4.0-16.tar.gz Keywords: Imported nxagent-3.4.0-16.tar.gz into Git repository
* Imported nxagent-3.4.0-11.tar.gznxagent/3.4.0-11Reinhard Tartler2011-10-101-2/+2
| | | | | | | | Summary: Imported nxagent-3.4.0-11.tar.gz Keywords: Imported nxagent-3.4.0-11.tar.gz into Git repository
* Imported nxagent-3.1.0-2.tar.gznxagent/3.1.0-2Reinhard Tartler2011-10-101-0/+2883
Summary: Imported nxagent-3.1.0-2.tar.gz Keywords: Imported nxagent-3.1.0-2.tar.gz into Git repository