Text  |   XML   |   Visible Warnings:

irssi-0.8.14 : irssi-0.8.14 analysis 2 : Null Pointer Dereference  at nicklist.c:490

Categories: LANG.MEM.NPD CWE:476
Warning ID: 4754.28257
Procedure: nick_nfind
Trace: view
Modified: Thu Nov 26 11:08:21 2009   show details
 
Priority: None
State: None
Finding: None
Owner: None
  edit properties

Legend [ X ]
Warning Location
Contributes
Parse Error
Other Warning
Two or More Loop Iterations
On Execution Path
Comment
Macro
Preprocessor
Include
Keyword
Preprocessed Away

Source  |  Language: C Hide Legend     
ProblemLineSource
   /kat0/fletcher/SATE/2010/irssi-0.8.14/src/core/nicklist.c
   Enter nick_match_msg
 506 int nick_match_msg(CHANNEL_REC *channel, const char *msg, const char *nick) 
 507 {
 508         const char *msgstart, *orignick;
 509         int len, fullmatch;
 510  
 511         g_return_val_if_fail(nick != NULL, FALSE);
 512         g_return_val_if_fail(msg != NULL, FALSE);
 513  
true514         if (channel != NULL && channel->server->nick_match_msg != NULL)
 515                 return channel->server->nick_match_msg(msg, nick);
 516  
 517         /* first check for identical match */ 
 518         len = strlen(nick);
 519         if (g_strncasecmp(msg, nick, len) == 0 && !isalnumhigh((int) msg[len]))
 520                 return TRUE;
 521  
 522         orignick = nick;
 523         for (;;) {
 524                 nick = orignick;
 525                 msgstart = msg;
 526                 fullmatch = TRUE;
 527  
 528                 /* check if it matches for alphanumeric parts of nick */ 
 529                 while (*nick != '\0' && *msg != '\0') {
 530                         if (i_toupper(*nick) == i_toupper(*msg)) {
 531                                 /* total match */ 
 532                                 msg++;
 533                         } else if (i_isalnum(*msg) && !i_isalnum(*nick)) {
 534                                 /* some strange char in your nick, pass it */ 
 535                                 fullmatch = FALSE;
 536                         } else 
 537                                 break;
 538  
 539                         nick++;
 540                 }
 541  
 542                 if (msg != msgstart && !isalnumhigh(*msg)) {
 543                         /* at least some of the chars in line matched the 
 544                            nick, and msg continue with non-alphanum character,
 545                            this might be for us.. */ 
 546                         if (*nick != '\0') {
 547                                 /* remove the rest of the non-alphanum chars 
 548                                    from nick and check if it then matches. */ 
 549                                 fullmatch = FALSE;
 550                                 while (*nick != '\0' && !i_isalnum(*nick))
 551                                         nick++;
 552                         }
 553  
 554                         if (*nick == '\0') {
 555                                 /* yes, match! */ 
 556                                 break;
 557                         }
 558                 }
 559  
 560                 /* no match. check if this is a message to multiple people 
 561                    (like nick1,nick2: text) */ 
 562                 while (*msg != '\0' && *msg != ' ' && *msg != ',') msg++;
 563  
 564                 if (*msg != ',') {
 565                         nick = orignick;
 566                         break;
 567                 }
 568  
 569                 msg++;
 570         }
 571  
 572         if (*nick != '\0')
 573                 return FALSE; /* didn't match */ 
 574  
 575         if (fullmatch)
 576                 return TRUE; /* matched without fuzzyness */ 
 577  
 578         /* matched with some fuzzyness .. check if there's an exact match 
 579            for some other nick in the same channel. */ 
channel <= 4095580         return nick_nfind(channel, msgstart, (int) (msg-msgstart)) == NULL;
     Enter nick_match_msg / nick_nfind
 484   static NICK_REC *nick_nfind(CHANNEL_REC *channel, const char *nick, int len) 
 485   {
 486           NICK_REC *rec;
 487           char *tmpnick;
 488    
 489           tmpnick = g_strndup(nick, len);
channel <= 4095490           rec = g_hash_table_lookup(channel->nicks, tmpnick);     /* Null Pointer Dereference */
     Exit nick_match_msg / nick_nfind
Preconditions
channel = 0
&$unknown_73058 != 0
&$unknown_73062 != nick
&$unknown_73063 >= len + 1
strlen(nick) != 0
strlen(len) > 0
((char*)&$unknown_73059)[1] <= 122
((char*)&$unknown_73059)[1] >= 97
$unknown_73062 != ((char*)&$unknown_73059)[1]
$unknown_73062 <= 122
$unknown_73062 >= 97
strlen(&$unknown_73062) != 0
$unknown_73063 != 0
strlen(&$unknown_73063) = 2
((char*)&$unknown_73063)[2] = 0
((char*)&$unknown_73063)[1] != 0
Postconditions
_g_boolean_var_' = 1
_g_boolean_var_' = 1
channel' = channel
fullmatch' = 0
len' = strlen(nick)
len' = &$unknown_73064
msg' = &$unknown_73062
msgstart' = msg
nick' = msg
nick' = &$unknown_73063 + 2
orignick' = nick




Change Warning 4754.28257 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: