Text  |   XML   |   Visible Warnings:

Irssi : Irssi analysis 1 : Null Pointer Dereference  at nicklist.c:490

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2110.2111
Procedure: nick_nfind
Trace: View
Modified: Wed Sep 2 11:51:17 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
   /u1/paul/SATE/2010/c/irssi/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
$param_1 <= 4095484   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
$param_1 = 0
&$unknown_120641 = strlen($param_3)
&$unknown_120641 > 0
&$unknown_120642 != 0
&$unknown_120644 != 0
&$unknown_120645 != 0
&$unknown_120646 != $param_2
&$unknown_120647 != 0
&$unknown_120648 != 0
&$unknown_120649 >= $param_3 + 1
strlen($param_2) != 0
strlen($param_3) > 0
$unknown_120646 != 0
$unknown_120646 <= 127
strlen(&$unknown_120646) != 0
$unknown_120649 != 0
strlen(&$unknown_120649) = 2
((char*)&$unknown_120649)[2] = 0
((char*)&$unknown_120649)[1] != 0
Postconditions
_g_boolean_var_' = 1
_g_boolean_var_' = 1
channel' = $param_1
channel' = $param_1
fullmatch' = 0
len' = &$unknown_120650
len' = strlen($param_3)
msg' = &$unknown_120646
msgstart' = $param_2
nick' = &$unknown_120649 + 2
nick' = $param_2
orignick' = $param_3




Change Warning 2110.2111 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: