mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-08 16:06:16 -05:00
21b3b75515
* gnu/packages/patches/glib-CVE-2021-27218.patch, gnu/packages/patches/glib-CVE-2021-27219-01.patch, gnu/packages/patches/glib-CVE-2021-27219-02.patch, gnu/packages/patches/glib-CVE-2021-27219-03.patch, gnu/packages/patches/glib-CVE-2021-27219-04.patch, gnu/packages/patches/glib-CVE-2021-27219-05.patch, gnu/packages/patches/glib-CVE-2021-27219-06.patch, gnu/packages/patches/glib-CVE-2021-27219-07.patch, gnu/packages/patches/glib-CVE-2021-27219-08.patch, gnu/packages/patches/glib-CVE-2021-27219-09.patch, gnu/packages/patches/glib-CVE-2021-27219-10.patch, gnu/packages/patches/glib-CVE-2021-27219-11.patch, gnu/packages/patches/glib-CVE-2021-27219-12.patch, gnu/packages/patches/glib-CVE-2021-27219-13.patch, gnu/packages/patches/glib-CVE-2021-27219-14.patch, gnu/packages/patches/glib-CVE-2021-27219-15.patch, gnu/packages/patches/glib-CVE-2021-27219-16.patch, gnu/packages/patches/glib-CVE-2021-27219-17.patch, gnu/packages/patches/glib-CVE-2021-27219-18.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/glib.scm (glib)[replacement]: New field. (glib/fixed): New variable.
98 lines
3.6 KiB
Diff
98 lines
3.6 KiB
Diff
From 65ec7f4d6e8832c481f6e00e2eb007b9a60024ce Mon Sep 17 00:00:00 2001
|
||
From: Philip Withnall <pwithnall@endlessos.org>
|
||
Date: Thu, 4 Feb 2021 14:00:53 +0000
|
||
Subject: [PATCH 09/11] gsocket: Use gsize to track native sockaddr's size
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
Don’t use an `int`, that’s potentially too small. In practical terms,
|
||
this is not a problem, since no socket address is going to be that big.
|
||
|
||
By making these changes we can use `g_memdup2()` without warnings,
|
||
though. Fewer warnings is good.
|
||
|
||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
||
Helps: #2319
|
||
---
|
||
gio/gsocket.c | 16 ++++++++++------
|
||
1 file changed, 10 insertions(+), 6 deletions(-)
|
||
|
||
diff --git a/gio/gsocket.c b/gio/gsocket.c
|
||
index 66073af83..a3af149e8 100644
|
||
--- a/gio/gsocket.c
|
||
+++ b/gio/gsocket.c
|
||
@@ -75,6 +75,7 @@
|
||
#include "gcredentialsprivate.h"
|
||
#include "glibintl.h"
|
||
#include "gioprivate.h"
|
||
+#include "gstrfuncsprivate.h"
|
||
|
||
#ifdef G_OS_WIN32
|
||
/* For Windows XP runtime compatibility, but use the system's if_nametoindex() if available */
|
||
@@ -174,7 +175,7 @@ static gboolean g_socket_datagram_based_condition_wait (GDatagramBased
|
||
GError **error);
|
||
|
||
static GSocketAddress *
|
||
-cache_recv_address (GSocket *socket, struct sockaddr *native, int native_len);
|
||
+cache_recv_address (GSocket *socket, struct sockaddr *native, size_t native_len);
|
||
|
||
static gssize
|
||
g_socket_receive_message_with_timeout (GSocket *socket,
|
||
@@ -260,7 +261,7 @@ struct _GSocketPrivate
|
||
struct {
|
||
GSocketAddress *addr;
|
||
struct sockaddr *native;
|
||
- gint native_len;
|
||
+ gsize native_len;
|
||
guint64 last_used;
|
||
} recv_addr_cache[RECV_ADDR_CACHE_SIZE];
|
||
};
|
||
@@ -5211,14 +5212,14 @@ g_socket_send_messages_with_timeout (GSocket *socket,
|
||
}
|
||
|
||
static GSocketAddress *
|
||
-cache_recv_address (GSocket *socket, struct sockaddr *native, int native_len)
|
||
+cache_recv_address (GSocket *socket, struct sockaddr *native, size_t native_len)
|
||
{
|
||
GSocketAddress *saddr;
|
||
gint i;
|
||
guint64 oldest_time = G_MAXUINT64;
|
||
gint oldest_index = 0;
|
||
|
||
- if (native_len <= 0)
|
||
+ if (native_len == 0)
|
||
return NULL;
|
||
|
||
saddr = NULL;
|
||
@@ -5226,7 +5227,7 @@ cache_recv_address (GSocket *socket, struct sockaddr *native, int native_len)
|
||
{
|
||
GSocketAddress *tmp = socket->priv->recv_addr_cache[i].addr;
|
||
gpointer tmp_native = socket->priv->recv_addr_cache[i].native;
|
||
- gint tmp_native_len = socket->priv->recv_addr_cache[i].native_len;
|
||
+ gsize tmp_native_len = socket->priv->recv_addr_cache[i].native_len;
|
||
|
||
if (!tmp)
|
||
continue;
|
||
@@ -5256,7 +5257,7 @@ cache_recv_address (GSocket *socket, struct sockaddr *native, int native_len)
|
||
g_free (socket->priv->recv_addr_cache[oldest_index].native);
|
||
}
|
||
|
||
- socket->priv->recv_addr_cache[oldest_index].native = g_memdup (native, native_len);
|
||
+ socket->priv->recv_addr_cache[oldest_index].native = g_memdup2 (native, native_len);
|
||
socket->priv->recv_addr_cache[oldest_index].native_len = native_len;
|
||
socket->priv->recv_addr_cache[oldest_index].addr = g_object_ref (saddr);
|
||
socket->priv->recv_addr_cache[oldest_index].last_used = g_get_monotonic_time ();
|
||
@@ -5404,6 +5405,9 @@ g_socket_receive_message_with_timeout (GSocket *socket,
|
||
/* do it */
|
||
while (1)
|
||
{
|
||
+ /* addrlen has to be of type int because that’s how WSARecvFrom() is defined */
|
||
+ G_STATIC_ASSERT (sizeof addr <= G_MAXINT);
|
||
+
|
||
addrlen = sizeof addr;
|
||
if (address)
|
||
result = WSARecvFrom (socket->priv->fd,
|
||
--
|
||
2.30.1
|
||
|