Commit ac71ee5d authored by Simon Ser's avatar Simon Ser Committed by Daniel Stone
Browse files

clients: sanitize XCURSOR_SIZE

Fixes wayland/weston#164
parent 22dd67cc
......@@ -79,6 +79,7 @@ typedef void *EGLContext;
#include "pointer-constraints-unstable-v1-client-protocol.h"
#include "relative-pointer-unstable-v1-client-protocol.h"
#include "shared/os-compatibility.h"
#include "shared/string-helpers.h"
#include "window.h"
......@@ -89,6 +90,8 @@ typedef void *EGLContext;
#define ZWP_RELATIVE_POINTER_MANAGER_V1_VERSION 1
#define ZWP_POINTER_CONSTRAINTS_V1_VERSION 1
#define DEFAULT_XCURSOR_SIZE 32
struct shm_pool;
struct global {
......@@ -1340,14 +1343,19 @@ create_cursors(struct display *display)
const char *config_file;
struct weston_config *config;
struct weston_config_section *s;
int size = 32;
char *theme = NULL;
int size = DEFAULT_XCURSOR_SIZE;
char *theme = NULL, *size_str;
unsigned int i, j;
struct wl_cursor *cursor;
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 = weston_config_parse(config_file);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment