Text  |   XML   |   Visible Warnings:

irssi-0.8.14 : irssi-0.8.14 analysis 2 : Uninitialized Variable  at dcc.c:170

Categories: LANG.MEM.UVAR CWE:457
Warning ID: 7267.28352
Procedure: dcc_ip2str
Trace: view
Modified: Thu Nov 26 11:09:00 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/dcc/dcc-send.c
   Enter dcc_send_one_file
 360 static int dcc_send_one_file(int queue, const char *target, const char *fname,
 361                              IRC_SERVER_REC *server, CHAT_DCC_REC *chat,
true362                              int passive) 
 363 {
 364         struct stat st;
 365         char *str;
 366         char host[MAX_IP_LEN];
 367         int hfile, port = 0;
 368         SEND_DCC_REC *dcc;
 369         IPADDR own_ip;
 370         GIOChannel *handle;
 371  
 372         if (dcc_find_request(DCC_SEND_TYPE, target, fname)) {
 373                 signal_emit("dcc error send exists", 2, target, fname);
 374                 return FALSE;
 375         }
 376  
 377         str = dcc_send_get_file(fname);
 378         hfile = open(str, O_RDONLY);
 379         g_free(str);
 380  
 381         if (hfile == -1) {
 382                 signal_emit("dcc error file open", 3, target, fname,
 383                             GINT_TO_POINTER(errno));
 384                 return FALSE;
 385         }
 386  
 387         if (fstat(hfile, &st) < 0) {
 388                 g_warning("fstat() failed: %s", strerror(errno));
 389                 close(hfile);
 390                 return FALSE;
 391         }
 392  
 393         /* start listening (only if passive == FALSE )*/ 
 394  
 395         if (passive == FALSE) {
 396                 handle = dcc_listen(chat != NULL ? chat->handle : 
 397                                     net_sendbuffer_handle(server->handle),
 398                                     &own_ip, &port);
 399                 if (handle == NULL) {
 400                         close(hfile);
 401                         g_warning("dcc_listen() failed: %s", strerror(errno));
 402                         return FALSE;
 403                 }
 404         } else {
 405                 handle = NULL;
 406         }
 407  
 408         fname = g_basename(fname);
 409  
 410         /* Replace all the spaces with underscore so that lesser 
 411            intelligent clients can communicate.. */ 
 412         if (!settings_get_bool("dcc_send_replace_space_with_underscore"))
 413                 str = NULL;
 414         else {
 415                 str = g_strdup(fname);
 416                 g_strdelimit(str, " ", '_');
 417                 fname = str;
 418         }
 419  
 420         dcc = dcc_send_create(server, chat, target, fname);
 421         g_free(str);
 422  
 423         dcc->handle = handle;
 424         dcc->port = port;
 425         dcc->size = st.st_size;
 426         dcc->fhandle = hfile;
 427         dcc->queue = queue;
 428         dcc->file_quoted = strchr(fname, ' ') != NULL;
 429         if (!passive) {
 430                 dcc->tagconn = g_input_add(handle, G_INPUT_READ,
 431                                            (GInputFunction) dcc_send_connected,   /* Dangerous Function Cast (ID: 1329.26775) */
 432                                            dcc);
 433         }
 434  
 435         /* Generate an ID for this send if using passive protocol */ 
 436         if (passive) {
 437                 dcc->pasv_id = rand() % 64;
 438         }
 439      
 440         /* send DCC request */ 
 441         signal_emit("dcc request send", 1, dcc);
 442  
 443      
own_ip is uninitialized444         dcc_ip2str(&own_ip, host);
     /kat0/fletcher/SATE/2010/irssi-0.8.14/src/irc/dcc/dcc.c
     Enter dcc_send_one_file / dcc_ip2str
 159   void dcc_ip2str(IPADDR *ip, char *host) 
 160   {
 161           IPADDR temp_ip;
 162           guint32 addr;
 163    
 164           if (*settings_get_str("dcc_own_ip") != '\0') {   /* Null Pointer Dereference (ID: 7258.28340) */
 165                   /* overridden IP address */ 
 166                   net_host2ip(settings_get_str("dcc_own_ip"), &temp_ip);
 167                   ip = &temp_ip;
 168           }
 169    
*ip is uninitialized170           if (IPADDR_IS_V6(ip)) {     /* Uninitialized Variable */
     Exit dcc_send_one_file / dcc_ip2str
Preconditions
host != 0
$param_6 != 0
&$unknown_329992 != -1
&$unknown_329994 != 0
&$unknown_329998 != 0
$unknown_329996 != 32
$unknown_330000 = 0
strlen(&$unknown_330000) = 0
dcc_conns >= 0
$input_12 >= 0
Postconditions
dcc' = &$unknown_329997
fname' = &$unknown_329996
handle' = 0
hfile' = &$unknown_329992
host' = &host[0]
ip' = &own_ip.family
next_uniq_id' = next_uniq_id + 1
port' = 0
str' = &$unknown_329996




Change Warning 7267.28352 : Uninitialized Variable

Priority:
State:
Finding:
Owner:
Note: