Text  |   XML   |   Visible Warnings:

Irssi : Irssi analysis 1 : Null Pointer Dereference  at fe-exec.c:180

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2242.2248
Procedure: process_destroy
Trace: View
Modified: Wed Sep 2 11:54:18 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/fe-common/core/fe-exec.c
   Enter handle_exec
 375 static void handle_exec(const char *args, GHashTable *optlist,
 376                         SERVER_REC *server, WI_ITEM_REC *item) 
 377 {
 378         PROCESS_REC *rec;
 379         SERVER_REC *target_server;
 380         char *target, *level;
 381         int notice, signum, interactive, target_nick, target_channel;
 382  
 383         /* check that there's no unknown options. we allowed them 
 384            because signals can be used as options, but there should be 
 385            only one unknown option: the signal name/number. */ 
 386         signum = cmd_options_get_signal("exec", optlist);
 387         if (signum == -2)
 388                 return;
 389  
 390         if (*args == '\0') {
 391                 exec_show_list();
 392                 return;
 393         }
 394  
 395         target = NULL;
 396         target_server = NULL;
 397         notice = FALSE;
 398  
 399         if (g_hash_table_lookup(optlist, "in") != NULL) {
 400                 rec = process_find(g_hash_table_lookup(optlist, "in"), TRUE);
 401                 if (rec != NULL) {
 402                         net_sendbuffer_send(rec->out, args, strlen(args));
 403                         net_sendbuffer_send(rec->out, "\n", 1);
 404                 }
 405                 return;
 406         }
 407  
 408         /* check if args is a process ID or name. if it's ID but not found,
 409            complain about it and fail immediately */ 
 410         rec = process_find(args, *args == '%');
 411         if (*args == '%' && rec == NULL)
 412                 return;
 413  
 414         /* common options */ 
 415         target_channel = target_nick = FALSE;
 416         if (g_hash_table_lookup(optlist, "out") != NULL) {
 417                 /* redirect output to active channel/query */ 
 418                 if (item == NULL)
 419                         cmd_return_error(CMDERR_NOT_JOINED);
 420                 target = (char *) window_item_get_target(item);
 421                 target_server = item->server;
 422                 target_channel = IS_CHANNEL(item);
 423                 target_nick = IS_QUERY(item);
 424         } else if (g_hash_table_lookup(optlist, "msg") != NULL) {
 425                 /* redirect output to /msg <nick> */ 
 426                 target = g_hash_table_lookup(optlist, "msg");
 427                 target_server = server;
 428         } else if (g_hash_table_lookup(optlist, "notice") != NULL) {
 429                 target = g_hash_table_lookup(optlist, "notice");
 430                 target_server = server;
 431                 notice = TRUE;
 432         }
 433  
 434         /* options that require process ID/name as argument */ 
true435         if (rec == NULL &&
 436             (signum != -1 || g_hash_table_lookup(optlist, "close") != NULL)) {
 437                 printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
 438                           "Unknown process name: %s", args);
 439                 return;
 440         }
 441         if (g_hash_table_lookup(optlist, "close") != NULL) {
 442                 /* forcibly close the process */ 
rec <= 4095443                 process_destroy(rec, -1);
     Enter handle_exec / process_destroy
$param_1 <= 4095174   static void process_destroy(PROCESS_REC *rec, int status) 
 175   {
 176           processes = g_slist_remove(processes, rec);
 177    
 178           signal_emit("exec remove", 2, rec, GINT_TO_POINTER(status));
 179    
rec <= 4095180           if (rec->read_tag != -1)     /* Null Pointer Dereference */
     Exit handle_exec / process_destroy
Preconditions
&$unknown_749107 != 0
&$unknown_749108 != 0
&$unknown_749110 = 0
&$unknown_749111 = -1
*$param_1 != 0
*$param_1 != 37
strlen($param_1) != 0
Postconditions
args' = $param_1
item' = $param_4
notice' = 0
optlist' = $param_2
rec' = 0
rec' = 0
server' = $param_3
signum' = -1
status' = -1
target_channel' = 1
target_nick' = 1




Change Warning 2242.2248 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: