diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2011-06-06 18:22:59 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2011-06-06 18:34:22 -0400 |
commit | 755301b1326cdc22d9e485d151f52f2993054762 (patch) | |
tree | 3fac8d9d47d61b471db53087b90c9e6254e5306d /src | |
parent | 3faee5d417bb0f162405a6e0ca1c6ab25e9a6b19 (diff) |
Forbid clients from creating or referencing views with reserved ID 0.
Diffstat (limited to 'src')
-rw-r--r-- | src/comm.c | 2 | ||||
-rw-r--r-- | src/view.c | 9 | ||||
-rw-r--r-- | src/view.h | 1 |
3 files changed, 8 insertions, 4 deletions
@@ -90,7 +90,7 @@ comm_create(struct client *c, struct buffer *b, struct lin_message *m) if (v) FD_LOG(1, "Warning: view %x already exists.\n", m->view); else { - v = view_new(c, b, m->view, 0); + v = view_new(c, b, m->view, VIEW_FLAGS_CLIENT); if (!v) { FD_LOG(0, "Failed to create view!\n"); return; @@ -75,9 +75,10 @@ view_lookup(struct client *c, int viewid) { struct view *v; - TAILQ_FOREACH(v, &c->views, client_next) - if (v->id == viewid) - return v; + if (viewid != 0) + TAILQ_FOREACH(v, &c->views, client_next) + if (v->id == viewid) + return v; return NULL; @@ -184,6 +185,8 @@ view_new(struct client *c, struct buffer *b, int id, unsigned int flags) if (c->num_views >= c->max_views) return NULL; + if (flags == VIEW_FLAGS_CLIENT && id == 0) + return NULL; /* create subsurface */ if (b->bsurface->GetSubSurface(b->bsurface, NULL, &vsurf) != DFB_OK) @@ -36,6 +36,7 @@ #include "sys-queue.h" +#define VIEW_FLAGS_CLIENT 0x1 /* view was created by a client */ #define VIEW_FLAGS_BACKGROUND 0x2 /* view is a background view */ #define VIEW_FLAGS_THUMBNAIL 0x4 /* view is a thumbnail view */ |