[Spice-commits] 2 commits - server/red_worker.c server/reds.c

Christophe Fergau teuf at kemper.freedesktop.org
Tue Jun 16 00:54:35 PDT 2015


 server/red_worker.c |    6 ++----
 server/reds.c       |    2 ++
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 939e643c2a014f973fd537b0420f8110ae13e856
Author: Cédric Bosdonnat <cbosdonnat at suse.com>
Date:   Wed Jun 3 16:19:44 2015 +0200

    Add password length check
    
    Don't allow setting a too long password.

diff --git a/server/reds.c b/server/reds.c
index 12c0bf4..cc26ca7 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3503,6 +3503,8 @@ SPICE_GNUC_VISIBLE int spice_server_set_ticket(SpiceServer *s,
         taTicket.expiration_time = now + lifetime;
     }
     if (passwd != NULL) {
+        if (strlen(passwd) > SPICE_MAX_PASSWORD_LENGTH)
+            return -1;
         g_strlcpy(taTicket.password, passwd, sizeof(taTicket.password));
     } else {
         memset(taTicket.password, 0, sizeof(taTicket.password));
commit 3c77eaa1d7f436e095c3042390b64d90851c350d
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Jun 10 14:53:05 2015 +0100

    Use spice_malloc instead of malloc
    
    Do not just check and give warning before crashing the program
    accessing a NULL pointer but use spice_malloc which exits with a
    proper message.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/red_worker.c b/server/red_worker.c
index a51b670..58a7d00 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1718,8 +1718,7 @@ static SurfaceDestroyItem *get_surface_destroy_item(RedChannel *channel,
 {
     SurfaceDestroyItem *destroy;
 
-    destroy = (SurfaceDestroyItem *)malloc(sizeof(SurfaceDestroyItem));
-    spice_warn_if(!destroy);
+    destroy = spice_malloc(sizeof(SurfaceDestroyItem));
 
     destroy->surface_destroy.surface_id = surface_id;
 
@@ -9577,8 +9576,7 @@ static SurfaceCreateItem *get_surface_create_item(
 {
     SurfaceCreateItem *create;
 
-    create = (SurfaceCreateItem *)malloc(sizeof(SurfaceCreateItem));
-    spice_warn_if(!create);
+    create = spice_malloc(sizeof(SurfaceCreateItem));
 
     create->surface_create.surface_id = surface_id;
     create->surface_create.width = width;


More information about the Spice-commits mailing list