typedef struct {
gchar *name;
- gint length;
+ gsize length;
gushort port;
} GSimpleProxyResolverDomain;
GSimpleProxyResolverPrivate *priv = resolver->priv;
gchar *ascii_host = NULL;
gboolean ignore = FALSE;
- gint i, length, offset;
+ gsize offset, length;
+ guint i;
if (priv->ignore_ips)
{
{
GSimpleProxyResolverDomain *domain = &priv->ignore_domains[i];
+ if (domain->length > length)
+ continue;
+
offset = length - domain->length;
if ((domain->port == 0 || domain->port == port) &&
(offset == 0 || (offset > 0 && host[offset - 1] == '.')) &&
* g_simple_proxy_resolver_new:
* @default_proxy: (nullable): the default proxy to use, eg
* "socks://192.168.1.1"
- * @ignore_hosts: (nullable): an optional list of hosts/IP addresses
+ * @ignore_hosts: (array zero-terminated=1) (nullable): an optional list of hosts/IP addresses
* to not use a proxy for.
*
* Creates a new #GSimpleProxyResolver. See
/**
* g_simple_proxy_resolver_set_ignore_hosts:
* @resolver: a #GSimpleProxyResolver
- * @ignore_hosts: %NULL-terminated list of hosts/IP addresses
+ * @ignore_hosts: (array zero-terminated=1): %NULL-terminated list of hosts/IP addresses
* to not use a proxy for
*
* Sets the list of ignored hosts.