1

Topic: [BUG] Trim functions in es_server.c to hungry

Hi,
I don't know if this has been already reported but I found a bug
in the server side source es_server.c which is still in the SVN too.

The *trim function also trims any chars with a code > 128. As you
may can think of, this is a signed/unsigned bug.

And as a bonus to prove matricks opinion false about modders tongue,
I'll post the patched functions here:

static const char *
str_ltrim(
    const char      *str_a )
{
    const unsigned char *str_b = (const unsigned char *)str_a;
    
    while ( *str_b && *str_b <= 32 )
        str_b++;
    
    return (const char *)str_b;
}

static void
str_rtrim(
    char            *str_a )
{
    unsigned char *str_b = (unsigned char *)str_a + strlen( str_a );
    
    while ( *(--str_b) <= 32 )
        ;
    
    *(str_b + 1) = '\0';
}
Yet another lich...

2

Re: [BUG] Trim functions in es_server.c to hungry

I have no time for this right now but I'll check it later. The trim function is voluntarily hungry so we can remove stupid nicks as well smile. Chars above 128 are non ANSI and depend on the charset used. Usually players can live without those characters.

3

Re: [BUG] Trim functions in es_server.c to hungry

Magnet wrote:

Chars above 128 are non ANSI and depend on the charset used.
Usually players can live without those characters.

I can't agree you here.  It seems to me that the current charset
in teeworlds 0.5.2 is latin-1 which is highly used in europa.

There is a high number of european teeworlds player and
just to say them they shall live without their charset is very
dangerous imho. Disabling the upper part of the charset
would disallow them to use their desired nickname. This is
a cut into their freedom.

And as they aren't filtered at any point in the strings but at the
beginning or the end, I clearly see this one as a bug.

This is the current situation, now let's talk about the SVN version.
It seems to be that further versions of that game will use the UTF-8
encoding of messages. But what I have written to the latin-1 codec
applies to the UTF-8 codec too.

Yet another lich...

4

Re: [BUG] Trim functions in es_server.c to hungry

I take note of your comments but as I said the problem is really not my priority if I get some time to put in TW dev (and the others are even busier). I have seen worse as an offense to personal freedom.