[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pidgin-commits
Subject:    im.pidgin.pidgin: f6e17bf35872d70d9ebba4cf860470a5b21d54ce
From:       markdoliner () pidgin ! im
Date:       2008-01-28 5:35:59
Message-ID: 20080128053559.386B648EB9 () homing ! pidgin ! im
[Download RAW message or body]

-----------------------------------------------------------------
Revision: f6e17bf35872d70d9ebba4cf860470a5b21d54ce
Ancestor: bb2d5971698f82249a6cf7e38e4a4d0a8aa97279
Author: markdoliner@pidgin.im
Date: 2008-01-28T05:31:28
Branch: im.pidgin.pidgin

Modified files:
        libpurple/protocols/bonjour/bonjour.c

ChangeLog:=20

>From the gethostname() man page:
"In case the null-terminated hostname does not fit, no error is
returned, but the hostname is truncated. It is unspecified whether
the truncated hostname will be null-terminated."



============================================================
--- libpurple/protocols/bonjour/bonjour.c	a532ad0424ce6c64941869d07dbccf1e82e234e2
+++ libpurple/protocols/bonjour/bonjour.c	193d7ec7ffc3265767b73922ece594d556189bef
@@ -673,11 +673,12 @@ initialize_default_account_values(void)
 
 	/* Try to figure out a good host name to use */
 	/* TODO: Avoid 'localhost,' if possible */
-	if (gethostname(hostname, 255) != 0) {
+	if (gethostname(hostname, sizeof(hostname)) != 0) {
 		purple_debug_warning("bonjour", "Error when getting host name: %s.  Using \"localhost.\"\n",
 				g_strerror(errno));
 		strcpy(hostname, "localhost");
 	}
+	hostname[sizeof(hostname) - 1] = '\0';
 	default_hostname = g_strdup(hostname);
 }
 


_______________________________________________
Commits mailing list
Commits@pidgin.im
http://pidgin.im/cgi-bin/mailman/listinfo/commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic