[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ITP: moleinvasion -- Jump'n run game with Tux



>>>>> "Henning" == Henning Makholm <henning@makholm.net> writes:

    Henning> Which, however, will not stop the code from dying
    Henning> horribly if $LANG does not contain an underscore (see
    Henning> /usr/share/locale/locale.alias), or if it contains an
    Henning> underscore that comes so late that there is no room for
    Henning> the LONG_TEXT_FILE string.

    Henning> (It does prevent executing arbitrary code taken from the
    Henning> environment variable _instead_ of dying horribly).

Not tested, other solutions also possible, but my point is developing
solutions shouldn't be hard:

--- cut ---
        FILE * fd=NULL;

        if(getenv("LANG"))
        {
                memset(lang,'\0',sizeof(lang));
                strncpy(getenv("LANG"),lang,sizeof(lang)-1);
                ptr=strchr(lang,"_");
                if (ptr) *ptr='\0';

                memset(buffer,'\0',sizeof(buffer));
                snprintf(buffer,sizeof(buffer)-1,"txt/%s_%s",getenv("LANG"),LONG_TXT_FILE);
--- cut ---

-- 
Brian May <bam@debian.org>



Reply to: