Text  |   XML   |   Visible Warnings:

Irssi : Irssi analysis 1 : Null Pointer Dereference  at misc.c:799

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2181.2186
Procedure: strocpy
Trace: View
Modified: Wed Sep 2 11:51:48 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/irc/core/irc-session.c
   Enter sig_session_restore_nick
 113 static void sig_session_restore_nick(IRC_CHANNEL_REC *channel,
 114                                      CONFIG_NODE *node) 
 115 {
 116         const char *nick, *prefixes;
 117         int op, halfop, voice;
 118         NICK_REC *nickrec;
 119         char newprefixes[MAX_USER_PREFIXES + 1];
 120         int i;
 121  
 122         if (!IS_IRC_CHANNEL(channel))
 123                 return;
 124  
 125         nick = config_node_get_str(node, "nick", NULL);
 126         if (nick == NULL)
 127                 return;
 128  
 129         op = config_node_get_bool(node, "op", FALSE);
 130         voice = config_node_get_bool(node, "voice", FALSE);
 131         halfop = config_node_get_bool(node, "halfop", FALSE);
true132         nickrec = irc_nicklist_insert(channel, nick, op, halfop, voice, FALSE);
 133         prefixes = config_node_get_str(node, "prefixes", NULL);
 134         if (prefixes == NULL || *prefixes == '\0') {
 135                 /* upgrading from old irssi or from an in-between 
 136                  * version that did not imply non-present prefixes from 
 137                  * op/voice/halfop, restore prefixes 
 138                  */ 
 139                 i = 0;
 140                 if (op)
 141                         newprefixes[i++] = '@';
 142                 if (halfop)
 143                         newprefixes[i++] = '%';
 144                 if (voice)
 145                         newprefixes[i++] = '+';
 146                 newprefixes[i] = '\0';
 147                 prefixes = newprefixes;
 148         }
 149         strocpy(nickrec->prefixes,
 150                 prefixes,
nickrec <= 4050151                 sizeof(nickrec->prefixes));
     /u1/paul/SATE/2010/c/irssi/irssi-0.8.14/src/core/misc.c
     Enter sig_session_restore_nick / strocpy
$param_1 <= 4095789   int strocpy(char *dest, const char *src, size_t dstsize) 
 790   {
 791           if (dstsize == 0)
 792                   return -1;
 793    
 794           while (*src != '\0' && dstsize > 1) {
 795                   *dest++ = *src++;   /* Null Pointer Dereference (ID: 2180.2185) */
 796                   dstsize--;
 797           }
 798    
dest <= 4095799           *dest++ = '\0';     /* Null Pointer Dereference */  /* Unused Value (ID: 2120.2121) */
     Exit sig_session_restore_nick / strocpy
Preconditions
&$unknown_449367 != 0
&$unknown_449370 = 8
*$param_2 <= 3
*$param_2 >= 2
$unknown_449369 = 0
strlen(&$unknown_449369) = 0
Postconditions
channel' = $param_1
dest' = 46
dstsize' = &$unknown_449370
halfop' = 0
i' = 0
newprefixes[0]' = 0
strlen(&newprefixes[0])' = 0
nick' = &$unknown_449367
nickrec' = 0
node' = $param_2
op' = 0
prefixes' = &newprefixes[0]
src' = &newprefixes[0]
voice' = 0




Change Warning 2181.2186 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: