[Pidgin] #5219: oscar_normalize crashes when normalize string

Pidgin trac at pidgin.im
Thu Jul 10 12:57:52 EDT 2008


#5219: oscar_normalize crashes when normalize string
---------------------------+------------------------------------------------
  Reporter:  emilal        |       Owner:  lschiere     
      Type:  defect        |      Status:  closed       
  Priority:  minor         |   Milestone:               
 Component:  unclassified  |     Version:  2.4.0        
Resolution:                |    Keywords:  Oscar crashes
   Pending:  0             |  
---------------------------+------------------------------------------------
Comment (by emilal):

 Please replace with following code to dissable non UTF NULL string:

 oscar_normalize(const PurpleAccount *account, const char *str)
 {
         static char buf[BUF_LEN];
         char *tmp1, *tmp2;
         int i, j;

         g_return_val_if_fail(str != NULL, NULL);

         /* copy str to buf and skip all blanks */
         for (i=0, j=0; str[j] && i < BUF_LEN - 1; i++, j++)
         {
                 while (str[j] == ' ')
                         j++;
                 buf[i] = str[j];
         }
         buf[i] = '\0';

         tmp1 = g_utf8_strdown(buf, -1);
         tmp2 = g_utf8_normalize(tmp1, -1, G_NORMALIZE_DEFAULT);
         strcpy(buf, tmp2 != NULL:tmp2, tmp1);
         g_free(tmp2);
         g_free(tmp1);

         return buf;
 }

-- 
Ticket URL: <http://developer.pidgin.im/ticket/5219#comment:6>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list