119 lines
6.0 KiB
Diff
119 lines
6.0 KiB
Diff
diff -up gdm-2.99.0/common/gdm-address.h.fix-invalid-read gdm-2.99.0/common/gdm-address.h
|
|
--- gdm-2.99.0/common/gdm-address.h.fix-invalid-read 2007-10-13 19:38:03.000000000 -0400
|
|
+++ gdm-2.99.0/common/gdm-address.h 2007-10-13 23:50:30.000000000 -0400
|
|
@@ -40,7 +40,8 @@ typedef struct _GdmAddress GdmAddress;
|
|
|
|
GType gdm_address_get_type (void);
|
|
|
|
-GdmAddress * gdm_address_new_from_sockaddr_storage (struct sockaddr_storage *ss);
|
|
+GdmAddress * gdm_address_new_from_sockaddr (struct sockaddr *sa,
|
|
+ size_t size);
|
|
|
|
int gdm_address_get_family_type (GdmAddress *address);
|
|
struct sockaddr_storage *gdm_address_get_sockaddr_storage (GdmAddress *address);
|
|
diff -up gdm-2.99.0/common/gdm-address.c.fix-invalid-read gdm-2.99.0/common/gdm-address.c
|
|
--- gdm-2.99.0/common/gdm-address.c.fix-invalid-read 2007-10-13 19:38:03.000000000 -0400
|
|
+++ gdm-2.99.0/common/gdm-address.c 2007-10-13 23:55:37.000000000 -0400
|
|
@@ -84,22 +84,27 @@ gdm_address_get_family_type (GdmAddress
|
|
|
|
/**
|
|
* gdm_address_new_from_sockaddr:
|
|
- * @sa: A pointer to a sockaddr_storage.
|
|
+ * @sa: A pointer to a sockaddr.
|
|
+ * @size: size of sockaddr in bytes.
|
|
*
|
|
- * Creates a new #GdmAddress from @ss.
|
|
+ * Creates a new #GdmAddress from @sa.
|
|
*
|
|
* Return value: The new #GdmAddress
|
|
* or %NULL if @sa was invalid or the address family isn't supported.
|
|
**/
|
|
GdmAddress *
|
|
-gdm_address_new_from_sockaddr_storage (struct sockaddr_storage *ss)
|
|
+gdm_address_new_from_sockaddr (struct sockaddr *sa,
|
|
+ size_t size)
|
|
{
|
|
GdmAddress *addr;
|
|
|
|
- g_return_val_if_fail (ss != NULL, NULL);
|
|
+ g_return_val_if_fail (sa != NULL, NULL);
|
|
+ g_return_val_if_fail (size >= sizeof (struct sockaddr), NULL);
|
|
+ g_return_val_if_fail (size <= sizeof (struct sockaddr_storage), NULL);
|
|
|
|
addr = g_new0 (GdmAddress, 1);
|
|
- addr->ss = g_memdup (ss, sizeof (struct sockaddr_storage));
|
|
+ addr->ss = g_new0 (struct sockaddr_storage, 1);
|
|
+ memcpy (addr->ss, sa, size);
|
|
|
|
return addr;
|
|
}
|
|
@@ -315,7 +320,7 @@ gdm_address_peek_local_list (void)
|
|
for (res = result; res != NULL; res = res->ai_next) {
|
|
GdmAddress *address;
|
|
|
|
- address = gdm_address_new_from_sockaddr_storage ((struct sockaddr_storage *)res->ai_addr);
|
|
+ address = gdm_address_new_from_sockaddr (res->ai_addr, res->ai_addrlen);
|
|
the_list = g_list_append (the_list, address);
|
|
}
|
|
|
|
diff -up gdm-2.99.0/gui/simple-chooser/gdm-host-chooser-widget.c.fix-invalid-read gdm-2.99.0/gui/simple-chooser/gdm-host-chooser-widget.c
|
|
--- gdm-2.99.0/gui/simple-chooser/gdm-host-chooser-widget.c.fix-invalid-read 2007-10-13 19:38:03.000000000 -0400
|
|
+++ gdm-2.99.0/gui/simple-chooser/gdm-host-chooser-widget.c 2007-10-13 23:53:35.000000000 -0400
|
|
@@ -237,7 +237,7 @@ decode_packet (GIOChannel *sou
|
|
return TRUE;
|
|
}
|
|
|
|
- address = gdm_address_new_from_sockaddr_storage (&clnt_ss);
|
|
+ address = gdm_address_new_from_sockaddr ((struct sockaddr *) &clnt_ss, ss_len);
|
|
if (address == NULL) {
|
|
g_warning (_("XMDCP: Unable to parse address"));
|
|
return TRUE;
|
|
@@ -462,7 +462,7 @@ find_broadcast_addresses (GdmHostChooser
|
|
|
|
g_memmove (&sin, &ifreq.ifr_broadaddr, sizeof (struct sockaddr_in));
|
|
sin.sin_port = htons (XDM_UDP_PORT);
|
|
- address = gdm_address_new_from_sockaddr_storage ((struct sockaddr_storage *)&sin);
|
|
+ address = gdm_address_new_from_sockaddr ((struct sockaddr *) &sin, sizeof (sin));
|
|
if (address != NULL) {
|
|
g_debug ("Adding if %s", name);
|
|
gdm_address_debug (address);
|
|
@@ -518,7 +518,7 @@ add_hosts (GdmHostChooserWidget *widget)
|
|
for (ai = result; ai != NULL; ai = ai->ai_next) {
|
|
GdmAddress *address;
|
|
|
|
- address = gdm_address_new_from_sockaddr_storage ((struct sockaddr_storage *)ai->ai_addr);
|
|
+ address = gdm_address_new_from_sockaddr (ai->ai_addr, ai->ai_addrlen);
|
|
if (address != NULL) {
|
|
widget->priv->query_addresses = g_slist_append (widget->priv->query_addresses, address);
|
|
}
|
|
diff -up gdm-2.99.0/daemon/gdm-xdmcp-display-factory.c.fix-invalid-read gdm-2.99.0/daemon/gdm-xdmcp-display-factory.c
|
|
--- gdm-2.99.0/daemon/gdm-xdmcp-display-factory.c.fix-invalid-read 2007-10-13 19:38:03.000000000 -0400
|
|
+++ gdm-2.99.0/daemon/gdm-xdmcp-display-factory.c 2007-10-13 23:54:47.000000000 -0400
|
|
@@ -446,7 +446,7 @@ do_bind (guint port,
|
|
char *serv;
|
|
GdmAddress *addr;
|
|
|
|
- addr = gdm_address_new_from_sockaddr_storage ((struct sockaddr_storage *)ai->ai_addr);
|
|
+ addr = gdm_address_new_from_sockaddr (ai->ai_addr, ai->ai_addrlen);
|
|
|
|
host = NULL;
|
|
serv = NULL;
|
|
@@ -1356,7 +1356,7 @@ create_address_from_request (ARRAY8
|
|
if (ai != NULL) {
|
|
found = TRUE;
|
|
if (address != NULL) {
|
|
- *address = gdm_address_new_from_sockaddr_storage ((struct sockaddr_storage *)ai->ai_addr);
|
|
+ *address = gdm_address_new_from_sockaddr (ai->ai_addr, ai->ai_addrlen);
|
|
}
|
|
}
|
|
|
|
@@ -2629,7 +2629,7 @@ decode_packet (GIOChannel *s
|
|
return TRUE;
|
|
}
|
|
|
|
- address = gdm_address_new_from_sockaddr_storage (&clnt_ss);
|
|
+ address = gdm_address_new_from_sockaddr ((struct sockaddr *) &clnt_ss, ss_len);
|
|
if (address == NULL) {
|
|
g_warning (_("XMDCP: Unable to parse address"));
|
|
return TRUE;
|