changeset 22344:51e740d3af3b

Fixes an error detected by valgrind: ==10815== Conditional jump or move depends on uninitialised value(s) ==10815== at 0x45E89A8: purple_ip_address_is_valid (util.c:4138) ==10815== by 0x540A1C0: jabber_login_connect (jabber.c:573) ==10815== by 0x540A2BC: srv_resolved_cb (jabber.c:593) Credit goes to Andrew Gaul for discovering this and coming up with the fix, and sadrul for triple checking.
author Ka-Hing Cheung <khc@hxbc.us>
date Thu, 28 Feb 2008 08:41:23 +0000
parents 03b2b21b4c42
children d36ffc472585
files libpurple/util.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/util.c	Thu Feb 28 08:15:27 2008 +0000
+++ b/libpurple/util.c	Thu Feb 28 08:41:23 2008 +0000
@@ -4135,7 +4135,7 @@
 	int c, o1, o2, o3, o4;
 	char end;
 	c = sscanf(ip, "%d.%d.%d.%d%c", &o1, &o2, &o3, &o4, &end);
-	if (c > 4 || o1 < 0 || o1 > 255 || o2 < 0 || o2 > 255 || o3 < 0 || o3 > 255 || o4 < 0 || o4 > 255)
+	if (c != 4 || o1 < 0 || o1 > 255 || o2 < 0 || o2 > 255 || o3 < 0 || o3 > 255 || o4 < 0 || o4 > 255)
 		return FALSE;
 	return TRUE;
 }