# HG changeset patch # User Evan Schoenberg # Date 1178106867 0 # Node ID a9975d6c28321203e201c4398c9ec8035bd234ec # Parent 9a2ec0a033b50bf8e0c6d9a80699887cccdd6c16 The last name from /etc/passwd may have additional comma-delimited data which we should ignore when determining the default Bonjour name. Fixes #477 diff -r 9a2ec0a033b5 -r a9975d6c2832 libpurple/protocols/bonjour/bonjour.c --- a/libpurple/protocols/bonjour/bonjour.c Wed May 02 00:56:11 2007 +0000 +++ b/libpurple/protocols/bonjour/bonjour.c Wed May 02 11:54:27 2007 +0000 @@ -460,6 +460,7 @@ const char *fullname = NULL; #endif char *splitpoint = NULL; + char *tmp; char hostname[255]; #ifndef _WIN32 @@ -545,7 +546,16 @@ if (splitpoint != NULL) { default_firstname = g_strndup(fullname, splitpoint - fullname); - default_lastname = g_strdup(&splitpoint[1]); + tmp = &splitpoint[1]; + + /* The last name may be followed by a comma and additional data. + * Only use the last name itself. + */ + splitpoint = strchr(tmp, ','); + if (splitpoint != NULL) + default_lastname = g_strndup(tmp, splitpoint - tmp); + else + default_lastname = g_strdup(tmp); } else {