Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Null Pointer Dereference  at lpvm.c:2875

Categories: LANG.MEM.NPD CWE:476
Warning ID: 330.29008
Procedure: mksocs
Trace: view
Modified: Thu Nov 26 11:29:30 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/src/lpvm.c
   Enter mksocs
 2792 mksocs() 
 2793 {
 2794         char buf[128];
 2795 #ifndef WIN32 
 2796         int d;
 2797 #else 
 2798         HANDLE d; 
 2799 #endif 
 2800  
 2801 #ifdef SOCKLENISUINT 
 2802 #if defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2)
   ...
 2807 #else 
 2808         int oslen;
 2809 #endif 
 2810         int n;
 2811         int try;
 2812         char *p;
 2813 #ifndef NOUNIXDOM 
 2814         struct sockaddr_un uns;
 2815 #endif 
 2816  
 2817         if (topvmd)
 2818                 return 0;
 2819  
 2820         /*
 2821         * get addr of pvmd, make socket to talk.
 2822         * first try envar PVMSOCK, then try sockaddr file.
 2823         */ 
 2824  
 2825         if (!(p = getenv("PVMSOCK"))) {
 2826                 if (!(p = pvmdsockfile())) {   /* Redundant Condition (ID: 327.29006) */
 2827                         pvmlogerror("mksocs() pvmdsockfile() failed\n");   /* Unreachable Call (ID: 328.29007) */
 2828                         goto bail;
 2829                 }
 2830 #ifndef WIN32 
 2831                 if ((d = open(p, O_RDONLY, 0)) == -1) {
 2832 #else  
 2833                 d = win32_open_file(p);
 2834                 if (d == (HANDLE) -2) {
 2835                         system_loser_win=TRUE;
 2836                         d = (HANDLE) _open(p,O_RDONLY,0);
 2837                 }
 2838                 if (d== (HANDLE) -1) { 
 2839 #endif 
 2840                         pvmlogperror(p);
 2841                         goto bail;
   ...
 2843 #ifdef WIN32 
 2844                 if (!system_loser_win) {
 2845                         n = win32_read_file(d,buf,sizeof(buf));
 2846                         win32_close_file(d);
 2847                 }
 2848                 else  {
 2849                         n = (int)_read((int)d, (void *)buf, (unsigned int)sizeof(buf));
 2850                         (void)_close((int)d);
 2851                 } 
 2852 #else 
 2853                 n = read(d, buf, sizeof(buf));
 2854                 (void)close(d);
 2855 #endif 
 2856                 if (n == -1) {
 2857                         pvmlogperror("mksocs() read addr file");
 2858                         goto bail;
 2859                 }
 2860                 if (n == 0) {
 2861                         pvmlogerror("mksocs() read addr file: wrong length read\n");
 2862                         goto bail;
 2863                 }
 2864                 buf[n] = 0;   /* Buffer Overrun (ID: 331.29010) */
 2865                 p = buf;
 2866         }
 2867  
 2868         FD_ZERO(&pvmrfds);
 2869 /*
 2870         FD_ZERO(&pvmwfds);
 2871 */ 
 2872         pvmnfds = 0;
 2873  
true2874         topvmd = ttpcb_new();
topvmd <= 40952875         topvmd->tt_tid = TIDPVMD;     /* Null Pointer Dereference */
Preconditions
$input_12 >= 0
$input_194476 <= 128
$input_194476 >= 1
td = 0
topvmd = 0
Postconditions
buf[0]' = $input_868
strlen(&buf[0])' = $input_12 + 17
strlen(&buf[0])' = $input_194476
buf[0]' is accessed by path name
d' = &$heap_335023 - 4096
errno' != 0
$heap_335022' = $input_444
bytes_after(&$heap_335022)' = $input_12 + 1
$heap_335022' is allocated by malloc
$heap_335022' is a non-heap object
bytes_before(&$heap_335022)' = 0
strlen(&$heap_335022)' = $input_12
$heap_335023' is allocated by open
n' = $input_194476
p' = &buf[0]
pvmnfds' = 0
td' = &$heap_335022
topvmd' = 0




Change Warning 330.29008 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: