Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Yandex, Google, DotBot

Members: 0
Guests: 13
Stats
Files
Topics
Posts
Members
Newest Member
481
3,739
19,386
622
ignatius
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SmaugFUSS Bugfix List » [Bug] Web links incorrectly p...
Forum Rules | Mark all | Recent Posts

[Bug] Web links incorrectly parse color tags when they should not
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Aug 13, 2006, 9:20 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

Bug: Web links incorrectly parse color tags when they should not
Danger: Trivial - The only thing affected by this are URL's.
Found by: Kiasyn
Fixed by: Remcon

---

color.c, colorize

Locate:
      while( ( colstr = strpbrk( prevstr, "&^}" ) ) != NULL )
      {
         register int reslen = 0;

         if( colstr > prevstr )
         {
            if( ( MAX_STRING_LENGTH - ( reslen = strlen( result ) ) ) <= ( colstr - prevstr ) )
            {
               bug( "%s: OVERFLOW in internal MAX_STRING_LENGTH buffer!", __PRETTY_FUNCTION__ );
               break;
            }
            strncat( result, prevstr, ( colstr - prevstr ) );  /* Leave this one alone! BAD THINGS(TM) will happen if you don't! */
            result[reslen + ( colstr - prevstr )] = '\0';   /* strncat will NOT NULL terminate this! */
         }
         ln = colorcode( colstr, colbuf, d, 20, NULL );
         if( ln > 0 )
         {
            mudstrlcat( result, colbuf, MAX_STRING_LENGTH );
            prevstr = colstr + ln;
         }
         else
            prevstr = colstr + 1;
      }


Change to:
      while( ( colstr = strpbrk( prevstr, "&^}hH" ) ) != NULL )
      {
         register int reslen = 0;

         if( colstr > prevstr )
         {
            if( ( MAX_STRING_LENGTH - ( reslen = strlen( result ) ) ) <= ( colstr - prevstr ) )
            {
               bug( "%s: OVERFLOW in internal MAX_STRING_LENGTH buffer!", __PRETTY_FUNCTION__ );
               break;
            }
            strncat( result, prevstr, ( colstr - prevstr ) );  /* Leave this one alone! BAD THINGS(TM) will happen if you don't! */
            result[reslen + ( colstr - prevstr )] = '\0';   /* strncat will NOT NULL terminate this! */
         }

         if( colstr[0] == 'h' || colstr[0] == 'H' )
            if( colstr[1] == 't' || colstr[1] == 'T' )
               if( colstr[2] == 't' || colstr[2] == 'T' )
                  if( colstr[3] == 'p' || colstr[3] == 'P' )
                  {
                     char http[MAX_INPUT_LENGTH];

                     one_argument( colstr, http );
                     mudstrlcat( result, http, sizeof( result ) );
                     ln = strlen( http );
                     prevstr = colstr + ln;
                     continue;
                  }

         ln = colorcode( colstr, colbuf, d, 20, NULL );
         if( ln > 0 )
         {
            mudstrlcat( result, colbuf, MAX_STRING_LENGTH );
            prevstr = colstr + ln;
         }
         else
            prevstr = colstr + 1;
      }


This fix exempts formatted URL's from having color tags be parsed. A URL will often contain a & which is the most common annoyance when dealing with Smaug's color system. Other symbols commonly uses, such as tildes, have no real affect unless they come in over IMC and get improperly parsed by the network code.
       
Pages:<< prev 1 next >>