clients: sanitize XCURSOR_SIZE
Fixes https://gitlab.freedesktop.org/wayland/weston/issues/164
This commit is contained in:
+12
-4
@@ -79,6 +79,7 @@ typedef void *EGLContext;
|
|||||||
#include "pointer-constraints-unstable-v1-client-protocol.h"
|
#include "pointer-constraints-unstable-v1-client-protocol.h"
|
||||||
#include "relative-pointer-unstable-v1-client-protocol.h"
|
#include "relative-pointer-unstable-v1-client-protocol.h"
|
||||||
#include "shared/os-compatibility.h"
|
#include "shared/os-compatibility.h"
|
||||||
|
#include "shared/string-helpers.h"
|
||||||
|
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
@@ -89,6 +90,8 @@ typedef void *EGLContext;
|
|||||||
#define ZWP_RELATIVE_POINTER_MANAGER_V1_VERSION 1
|
#define ZWP_RELATIVE_POINTER_MANAGER_V1_VERSION 1
|
||||||
#define ZWP_POINTER_CONSTRAINTS_V1_VERSION 1
|
#define ZWP_POINTER_CONSTRAINTS_V1_VERSION 1
|
||||||
|
|
||||||
|
#define DEFAULT_XCURSOR_SIZE 32
|
||||||
|
|
||||||
struct shm_pool;
|
struct shm_pool;
|
||||||
|
|
||||||
struct global {
|
struct global {
|
||||||
@@ -1340,14 +1343,19 @@ create_cursors(struct display *display)
|
|||||||
const char *config_file;
|
const char *config_file;
|
||||||
struct weston_config *config;
|
struct weston_config *config;
|
||||||
struct weston_config_section *s;
|
struct weston_config_section *s;
|
||||||
int size = 32;
|
int size = DEFAULT_XCURSOR_SIZE;
|
||||||
char *theme = NULL;
|
char *theme = NULL, *size_str;
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
struct wl_cursor *cursor;
|
struct wl_cursor *cursor;
|
||||||
|
|
||||||
theme = getenv("XCURSOR_THEME");
|
theme = getenv("XCURSOR_THEME");
|
||||||
if (getenv("XCURSOR_SIZE"))
|
|
||||||
size = atoi(getenv("XCURSOR_SIZE"));
|
size_str = getenv("XCURSOR_SIZE");
|
||||||
|
if (size_str) {
|
||||||
|
safe_strtoint(size_str, &size);
|
||||||
|
if (size <= 0)
|
||||||
|
size = DEFAULT_XCURSOR_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
config_file = weston_config_get_name_from_env();
|
config_file = weston_config_get_name_from_env();
|
||||||
config = weston_config_parse(config_file);
|
config = weston_config_parse(config_file);
|
||||||
|
|||||||
Reference in New Issue
Block a user