Commit Graph

10 Commits

Author SHA1 Message Date
Yuya Nishihara a71d565138 Revert "xcursor: use strncat instead of strncpy"
This reverts commit 7dffe9339b, which introduced
another linter error with -O3:

  error: ‘strncat’ specified bound 7 equals source length [-Werror=stringop-overflow=]

This makes sense because strncat(dest, "cursors", strlen("cursors")) is moot
in security point of view.

The next commit will replace strncpy() with memcpy(), so let's restore the
original implementation.
2021-04-13 16:55:46 +02:00
Lukas Märdian 7dffe9339b xcursor: use strncat instead of strncpy
strncat appends '\0' automatically and avoids the stringop-truncation
warning/error
2021-03-08 12:03:48 +01:00
Lukas Märdian d8a422575b Fix false positive -Wstringop-truncation
Fix false positive stringop-truncation warning/error with GCC 10 on s390x by indicating GCC to explicitly ignore this case, as it is clearly a false positive (NUL is set in the following line).

This allow the compilation to succeed with -Werror on.

Fixes: https://github.com/swaywm/wlroots/issues/2018
2021-03-08 12:03:48 +01:00
Valentin 65abd4e92a Fix undefined behavior
Without the casts the bytes accesses get converted to int. but int is
not guaranteed to be 4 bytes large. Even when it is 4 bytes large
`bytes[3] << 24` does not fit because int is signed.
2020-09-01 11:58:56 +02:00
Kirill Chibisov 6c8f66ff59 xcursor: add xorg-x11 and cursors path to XCURSORPATH
This should match default XCURSORPATH, which is used by libwayland-cursor
and other xcursor loading libraries more closely.
2020-06-26 11:20:52 +02:00
Cosimo Cecchi 14f45c056f
xcursor: Support XDG user data dir location
Nowadays ~/.icons is not used anymore as the preferred location for custom
user icon themes; XDG_DATA_HOME/icons (aka ~/.local/share/icons) is what
toolkits like GTK prefer. Prepend that location to the default xcursor path, so
that cursor themes installed there can be used by apps and toolkits that use
libXcursor.

Port of https://cgit.freedesktop.org/xorg/lib/libXcursor/commit/src?id=2263c196cb0dcb8547b378df7b35f83b8b99c01e
2018-11-27 23:21:07 +01:00
Philipp Ludwig e7fba556a8
xcursor: fix crash when encountering cursor themes with circular dependencies
Port of https://cgit.freedesktop.org/xorg/lib/libXcursor/commit/src?id=f64a8cc1a65dcad4294e2988b402a34175019663
2018-11-27 23:19:26 +01:00
Tobias Stoeckmann de0a032d8e
xcursor: Fix heap overflows when parsing malicious files
It is possible to trigger heap overflows due to an integer overflow
while parsing images.

The integer overflow occurs because the chosen limit 0x10000 for
dimensions is too large for 32 bit systems, because each pixel takes
4 bytes. Properly chosen values allow an overflow which in turn will
lead to less allocated memory than needed for subsequent reads.

See also:
https://cgit.freedesktop.org/xorg/lib/libXcursor/commit/?id=4794b5dd34688158fb51a2943032569d3780c4b8
5d201df72f
2018-11-06 14:40:41 +01:00
emersion c2e1474010
Reformat all #include directives 2018-02-12 21:29:23 +01:00
Drew DeVault 7486263f7e Add xcursor sublibrary 2017-08-07 21:13:04 -04:00