Text  |   XML   |   Visible Warnings:

irssi-0.8.14 : irssi-0.8.14 analysis 2 : Null Pointer Dereference  at misc.c:795

Categories: LANG.MEM.NPD CWE:476
Warning ID: 7246.28328
Procedure: strocpy
Trace: view
Modified: Thu Nov 26 11:08:47 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/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 <= 4066151                 sizeof(nickrec->prefixes));
     /kat0/fletcher/SATE/2010/irssi-0.8.14/src/core/misc.c
     Enter sig_session_restore_nick / strocpy
 789   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) {
dest <= 4095795                   *dest++ = *src++;     /* Null Pointer Dereference */
     Exit sig_session_restore_nick / strocpy
Preconditions
&$unknown_269490 != 0
&$unknown_269491 != 0
&$unknown_269492 != 0
((char*)*src[8])[4] != 0
((char*)*src[8])[8] != 0
*src <= 3
*src >= 2
**src[8] <= 1
**src[8] >= 0
Postconditions
dest' = 30
dstsize' = 8
halfop' = &$unknown_269491
i' = 3
newprefixes[0]' = 64
strlen(&newprefixes[0])' = 3
newprefixes[2]' = 43
newprefixes[3]' = 0
newprefixes[1]' = 37
nick' = ((char*)*node->value)[8]
nickrec' = 0
op' = &$unknown_269490
prefixes' = &newprefixes[0]
src' = &newprefixes[0] + 1
voice' = &$unknown_269492




Change Warning 7246.28328 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: