Package: rdesktop
Version: 1.6.0-3
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu natty ubuntu-patch

Hi!

These patches have been applied in Ubuntu to solve some crashes on 64bit
systems, and are from the upstream subversion.

Thanks,

-Kees

-- 
Kees Cook                                            @debian.org
#! /bin/sh /usr/share/dpatch/dpatch-run
## Origin: 
http://rdesktop.svn.sourceforge.net/viewvc/rdesktop?view=revision&revision=1550
## Description: _NET_WORKAREA is interpreted wrong on 64-bit machines (-g 
workarea)
## Ubuntu-Bug: https://bugs.launchpad.net/ubuntu/+source/rdesktop/+bug/192218

@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' 
'--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' rdesktop-1.6.0~/ewmhints.c 
rdesktop-1.6.0/ewmhints.c
--- rdesktop-1.6.0~/ewmhints.c  2008-04-02 06:13:22.000000000 -0500
+++ rdesktop-1.6.0/ewmhints.c   2011-03-09 15:14:22.000000000 -0600
@@ -135,7 +135,7 @@
        int current_desktop;
        unsigned long nitems_return;
        unsigned char *prop_return;
-       uint32 *return_words;
+       long *return_words;
        const uint32 net_workarea_x_offset = 0;
        const uint32 net_workarea_y_offset = 1;
        const uint32 net_workarea_width_offset = 2;
@@ -158,7 +158,7 @@
        if (current_desktop < 0)
                return -1;
 
-       return_words = (uint32 *) prop_return;
+       return_words = (long *) prop_return;
 
        *x = return_words[current_desktop * 4 + net_workarea_x_offset];
        *y = return_words[current_desktop * 4 + net_workarea_y_offset];
#! /bin/sh /usr/share/dpatch/dpatch-run
## 16_lp667275.dpatch by Kees Cook <k...@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Description: 64bit crashes while working with Xorg properties.
## DP: Origin: 
http://rdesktop.svn.sourceforge.net/viewvc/rdesktop/rdesktop/trunk/ewmhints.c?r1=1550&r2=1554&view=patch
## DP: Bug-Ubuntu: 
https://bugs.launchpad.net/ubuntu/+source/rdesktop/+bug/667275

@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' 
'--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' rdesktop-1.6.0~/ewmhints.c 
rdesktop-1.6.0/ewmhints.c
--- rdesktop-1.6.0~/ewmhints.c  2011-03-10 15:51:52.508918131 -0800
+++ rdesktop-1.6.0/ewmhints.c   2011-03-10 15:53:52.920441616 -0800
@@ -432,15 +432,15 @@
 {
        unsigned long nitems, i;
        unsigned char *props;
-       uint32 *cur_set, *new_set;
-       uint32 *icon;
+       unsigned long *cur_set, *new_set;
+       unsigned long *icon;
 
        cur_set = NULL;
        new_set = NULL;
 
        if (get_property_value(wnd, "_NET_WM_ICON", 10000, &nitems, &props, 1) 
>= 0)
        {
-               cur_set = (uint32 *) props;
+               cur_set = (unsigned long *) props;
 
                for (i = 0; i < nitems;)
                {
@@ -454,15 +454,15 @@
                        icon = cur_set + i;
                else
                {
-                       new_set = xmalloc((nitems + width * height + 2) * 4);
-                       memcpy(new_set, cur_set, nitems * 4);
+                       new_set = xmalloc((nitems + width * height + 2) * 
sizeof(unsigned long));
+                       memcpy(new_set, cur_set, nitems * sizeof(unsigned 
long));
                        icon = new_set + nitems;
                        nitems += width * height + 2;
                }
        }
        else
        {
-               new_set = xmalloc((width * height + 2) * 4);
+               new_set = xmalloc((width * height + 2) * sizeof(unsigned long));
                icon = new_set;
                nitems = width * height + 2;
        }
@@ -494,7 +494,7 @@
 {
        unsigned long nitems, i, icon_size;
        unsigned char *props;
-       uint32 *cur_set, *new_set;
+       unsigned long *cur_set, *new_set;
 
        cur_set = NULL;
        new_set = NULL;
@@ -502,7 +502,7 @@
        if (get_property_value(wnd, "_NET_WM_ICON", 10000, &nitems, &props, 1) 
< 0)
                return;
 
-       cur_set = (uint32 *) props;
+       cur_set = (unsigned long *) props;
 
        for (i = 0; i < nitems;)
        {
@@ -516,12 +516,13 @@
                goto out;
 
        icon_size = width * height + 2;
-       new_set = xmalloc((nitems - icon_size) * 4);
+       new_set = xmalloc((nitems - icon_size) * sizeof(unsigned long));
 
        if (i != 0)
-               memcpy(new_set, cur_set, i * 4);
+               memcpy(new_set, cur_set, i * sizeof(unsigned long));
        if (i != nitems - icon_size)
-               memcpy(new_set + i * 4, cur_set + i * 4 + icon_size, nitems - 
icon_size);
+               memcpy(new_set + i, cur_set + i + icon_size,
+                      (nitems - (i + icon_size)) * sizeof(unsigned long));
 
        nitems -= icon_size;
 

Reply via email to