[haiku-bugs] Re: [Haiku] #14746: Mail pegs a core in FindURL

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Sun, 16 Dec 2018 05:41:43 -0000

#14746: Mail pegs a core in FindURL
---------------------------------+----------------------------
   Reporter:  humdinger          |      Owner:  czeidler
       Type:  bug                |     Status:  new
   Priority:  normal             |  Milestone:  Unscheduled
  Component:  Applications/Mail  |    Version:  R1/Development
 Resolution:                     |   Keywords:
 Blocked By:                     |   Blocking:
Has a Patch:  0                  |   Platform:  All
---------------------------------+----------------------------

Comment (by owenca):

 I would modify the code thus:
 {{{
         if (urlString == NULL)
                 return type;

         // find the end of the URL based on word boundaries
         const char* str = string.String() + urlPos;
         urlLength = strcspn(str, " \t<>)\"\\,\r\n");

         // filter out some punctuation marks if they are the last
 character
         while (urlLength > 0) {
                 char suffix = str[urlLength - 1];
                 if (suffix != '.'
                                 && suffix != ','
                                 && suffix != '?'
                                 && suffix != '!'
                                 && suffix != ':'
                                 && suffix != ';')
                         break;
                 urlLength--;
         }

         *urlString = BString(string.String() + urlPos, urlLength);

         return type;
 }
 }}}

-- 
Ticket URL: <https://dev.haiku-os.org/ticket/14746#comment:4>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: