Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2003:
[Freeciv-Dev] (PR#6141) infinite string malloc
Home

[Freeciv-Dev] (PR#6141) infinite string malloc

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#6141) infinite string malloc
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 15 Sep 2003 14:32:18 -0700
Reply-to: rt@xxxxxxxxxxxxxx

[jdorje - Fri Sep 12 00:03:29 2003]:

> Sometimes with //TRANSLIT iconv gets confused and tries to output a 
> (seemingly) infinite-length string.  This results in an arbitrarily 
> large malloc which will eventually crash the server in S1_14.
> 
> It's too bad iconv has such a bad API.  The only two workarounds I see 
> are to not use //TRANSLIT (which is a bad idea; someone using ASCII 
> should still be able to see valid text via transliteration) or to cap 
> the string length.

Patch attached.  The patch does two things, either of which fix the
situation for me:

- An ASCII locale is detected and latin1 is used in its place.  This is
exactly what gui-gtk-2.0 already does.  In almost all cases this should
work correctly.

- If iconv fails at the conversion, rahter than have an unterminated
malloc call the situation is detected and the loop is aborted.

jason

Attachment: charset.diff
Description: charset.diff


[Prev in Thread] Current Thread [Next in Thread]