Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Bing

Members: 0
Guests: 6
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
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,639
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 >>