Text  |   XML   |   Visible Warnings:

irssi-0.8.14 : irssi-0.8.14 analysis 2 : Null Pointer Dereference  at terminfo-core.c:457

Categories: LANG.MEM.NPD CWE:476
Warning ID: 7449.28557
Procedure: terminfo_setup_colors
Trace: view
Modified: Thu Nov 26 11:21:13 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/fe-text/terminfo-core.c
   Enter terminfo_setup_colors
 409 void terminfo_setup_colors(TERM_REC *term, int force) 
 410 {
 411         static const char ansitab[16] = {
 412                 0, 4, 2, 6, 1, 5, 3, 7,
 413                 8, 12, 10, 14, 9, 13, 11, 15 
 414         };
 415         unsigned int i, color;
 416  
true417         terminfo_colors_deinit(term);
 418  
 419         if (force && term->TI_setf == NULL && term->TI_setaf == NULL)
 420                 term->TI_colors = 8;
 421  
 422         if ((term->TI_setf || term->TI_setaf || force) &&
 423              term->TI_colors > 0) {
 424                 term->TI_fg = g_new0(char *, term->TI_colors);
 425                 term->TI_bg = g_new0(char *, term->TI_colors);
 426                 term->set_fg = _set_fg;
 427                 term->set_bg = _set_bg;
 428         } else {
 429                 /* no colors */ 
 430                 term->TI_colors = 0;
 431                 term->set_fg = term->set_bg = _ignore_parm;
 432         }
 433  
 434         if (term->TI_setaf) {
 435                 for (i = 0; i < term->TI_colors; i++) {
 436                         color = i < 16 ? ansitab[i] : i;
 437                         term->TI_fg[i] = g_strdup(tparm(term->TI_setaf, color, 0));
 438                 }
 439         } else if (term->TI_setf) {
 440                 for (i = 0; i < term->TI_colors; i++)
 441                         term->TI_fg[i] = g_strdup(tparm(term->TI_setf, i, 0));
 442         } else if (force) {
 443                 for (i = 0; i < 8; i++)
 444                         term->TI_fg[i] = g_strdup_printf("\033[%dm", 30+ansitab[i]);
 445         }
 446  
 447         if (term->TI_setab) {
 448                 for (i = 0; i < term->TI_colors; i++) {
 449                         color = i < 16 ? ansitab[i] : i;
 450                         term->TI_bg[i] = g_strdup(tparm(term->TI_setab, color, 0));
 451                 }
 452         } else if (term->TI_setb) {
 453                 for (i = 0; i < term->TI_colors; i++)
 454                         term->TI_bg[i] = g_strdup(tparm(term->TI_setb, i, 0));
 455         } else if (force) {
 456                 for (i = 0; i < 8; i++)
term->TI_bg <= 4095457                         term->TI_bg[i] = g_strdup_printf("\033[%dm", 40+ansitab[i]);     /* Null Pointer Dereference */
Preconditions
force != 0
term->TI_colors <= 0
term->TI_setaf != 0
term->TI_setab = 0
term->TI_setf = 0
term->TI_setb = 0
term->TI_fg != 0
term->TI_bg != 0
Postconditions
i' = 0




Change Warning 7449.28557 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: