changeset 14466:5a09940b88f7

[gaim-migrate @ 17180] Don't allow dns lookups of empty strings committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 06 Sep 2006 10:06:58 +0000
parents 8395297271c6
children fd45915c6988
files libgaim/dnsquery.c
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/dnsquery.c	Wed Sep 06 10:04:34 2006 +0000
+++ b/libgaim/dnsquery.c	Wed Sep 06 10:06:58 2006 +0000
@@ -591,6 +591,12 @@
 	query_data->data = data;
 	query_data->resolver = NULL;
 
+	if (strlen(query_data->hostname) == 0)
+	{
+		gaim_dnsquery_destroy(query_data);
+		g_return_val_if_reached(NULL);
+	}
+
 	if (!queued_requests)
 		queued_requests = g_queue_new();
 	g_queue_push_tail(queued_requests, query_data);
@@ -757,6 +763,12 @@
 	query_data->error_message = NULL;
 	query_data->hosts = NULL;
 
+	if (strlen(query_data->hostname) == 0)
+	{
+		gaim_dnsquery_destroy(query_data);
+		g_return_val_if_reached(NULL);
+	}
+
 	/* Don't call the callback before returning */
 	query_data->timeout = gaim_timeout_add(0, resolve_host, query_data);
 
@@ -812,6 +824,7 @@
 
 	g_return_val_if_fail(hostname != NULL, NULL);
 	g_return_val_if_fail(port     != 0, NULL);
+	g_return_val_if_fail(callback != NULL, NULL);
 
 	query_data = g_new(GaimDnsQueryData, 1);
 	query_data->hostname = g_strdup(hostname);
@@ -820,6 +833,12 @@
 	query_data->callback = callback;
 	query_data->data = data;
 
+	if (strlen(query_data->hostname) == 0)
+	{
+		gaim_dnsquery_destroy(query_data);
+		g_return_val_if_reached(NULL);
+	}
+
 	/* Don't call the callback before returning */
 	query_data->timeout = gaim_timeout_add(0, resolve_host, query_data);