URL:
  <http://gna.org/bugs/?24754>

                 Summary: Last character stripped in chat and messages
                 Project: Freeciv
            Submitted by: mlinnaka
            Submitted on: Wed 15 Jun 2016 11:26:51 AM EEST
                Category: general
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: 2.5.2
         Discussion Lock: Any
        Operating System: Any
         Planned Release: 2.5.5
 Contains string changes: None

    _______________________________________________________

Details:

In Freeciv versions 2.5.2, 2.5.3 and 2.5.4 (no problem in older versions, did
not try 2.6.x series or trunk) when I play in Finnish, the last character gets
stripped in all messages and everything I write in chat.

It took me quite a while to notice, because the messages usually end in period
(.) or in exclamation mark (!), and when that is missing, you hardly notice.
In chat window it more obvious and much more annoying.

The bug was introduced with following commit:

------------------------------------------------------
Revision 30876
Modified Mon Dec 7 16:56:37 2015 CET by cazfi

Use fc_strlcpy() instead of strcpy()

See bug #24096
------------------------------------------------------

Problem is this line:
fc_strlcpy(result, str, len);

Changing it to len + 1 instead f just len fixes the problem in my tests.
fc_strlcpy() needs the length of the string including the trailing zero as
third argument.

For some reason the bug only occurs when I play in Finnish. I tried with
English, German, French, Swedish, they all work fine. Cannot really understand
how that can be. But in Finnish, the bug is systematic on both Windows and
Linux.





    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?24754>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to