[Freeciv-Dev] (PR#11372) pubserver crash in is_allowed_city_name
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=11372 >
I think this patch should fix it. But oddly I can't reproduce this.
-jason
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.276.2.7
diff -u -r1.276.2.7 citytools.c
--- server/citytools.c 5 Dec 2004 13:50:14 -0000 1.276.2.7
+++ server/citytools.c 7 Dec 2004 06:43:30 -0000
@@ -256,6 +256,8 @@
bool is_allowed_city_name(struct player *pplayer, const char *city_name,
char *error_buf, size_t bufsz)
{
+ struct connection *pconn;
+
/* Mode 1: A city name has to be unique for each player. */
if (game.allowed_city_names == 1 &&
city_list_find_name(&pplayer->cities, city_name)) {
@@ -310,7 +312,8 @@
* connections) can use non-ascii names. Otherwise players could use
* confusing garbage names in multi-player games. */
if (!is_ascii_name(city_name)
- && find_conn_by_user(pplayer->username)->access_level != ALLOW_HACK) {
+ && (pconn = find_conn_by_user(pplayer->username))
+ && pconn->access_level != ALLOW_HACK) {
if (error_buf) {
my_snprintf(error_buf, bufsz,
_("%s is not a valid name. Only ASCII or "
|
|