Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Null Pointer Dereference  at cmds.c:2034

Categories: LANG.MEM.NPD CWE:476
Warning ID: 518.29310
Procedure: setenv_cmd
Trace: view
Modified: Thu Nov 26 11:36:58 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/pvm3/console/cmds.c
   Enter setenv_cmd
 2006 setenv_cmd(ac, av) 
 2007         int ac;
 2008         char **av;
 2009 {
 2010         char **pp;
 2011         char *p;
 2012         char *sep;
 2013         int n;
 2014         int i;
 2015  
 2016         switch (ac) {
 2017  
 2018         case 1: 
 2019                 for (pp = environ; *pp; pp++)
 2020                         printf("%s\n", *pp);
 2021                 break;
 2022  
 2023         case 2: 
 2024                 if (p = getenv(av[1]))
 2025                         printf("%s\n", p);
 2026                 break;
 2027  
 2028         default: 
 2029                 if (ac > 2) {
 2030                         n = 0;
 2031                         for (i = ac; i-- > 1; )
 2032                                 n += strlen(av[i]) + 1;
true2033                         p = TALLOC(n, char, "env");
p <= 40952034                         strcpy(p, av[1]);     /* Null Pointer Dereference */
Preconditions
ac >= 3
Postconditions
errno' != 0
i' = 0
p' = 0




Change Warning 518.29310 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: