Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Buffer Overrun  at lpvm.c:2864

Categories: LANG.MEM.BO CWE:120 CWE:121 CWE:122 CWE:126
Warning ID: 331.29010
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
$input_194772 > 1272792 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  
$input_194780 > 1272817         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  
$input_194788 > 1272825         if (!(p = getenv("PVMSOCK"))) {
$input_194820 > 1272826                 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 
$input_12 > 1272853                 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                 }
n > 1272864                 buf[n] = 0;     /* Buffer Overrun */
Preconditions
$input_12 >= 0
$input_194868 <= 128
$input_194868 >= 1
td = 0
topvmd = 0
Postconditions
buf[0]' = $input_868
strlen(&buf[0])' = $input_12 + 17
buf[0]' is accessed by path name
d' = &$heap_335308 - 4096
errno' != 0
$heap_335307' = $input_444
bytes_after(&$heap_335307)' = $input_12 + 1
$heap_335307' is allocated by malloc
$heap_335307' is a non-heap object
bytes_before(&$heap_335307)' = 0
strlen(&$heap_335307)' = $input_12
$heap_335308' is allocated by open
n' = $input_194868
p' = &buf[0]
td' = &$heap_335307




Change Warning 331.29010 : Buffer Overrun

Priority:
State:
Finding:
Owner:
Note: