Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Buffer Overrun  at pvmd.c:5233

Categories: LANG.MEM.BO CWE:120 CWE:121 CWE:122 CWE:126
Warning ID: 2677.2726
Procedure: varsub
Trace: View
Modified: Wed Sep 2 12:43: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
   /u1/paul/SATE/2010/c/pvm/pvm3/src/pvmd.c
   Enter master_config
 5317 master_config(hn, argc, argv) 
 5318         char *hn;                       /* hostname or null */ 
 5319         int argc;
 5320         char **argv;
 5321 {
 5322         struct hostent *he;
 5323         struct hostd *hp;
 5324         struct hostd *hp2;
 5325         int i;
 5326         char *s;
 5327  
 5328         if (argc > 2) {
 5329                 pvmlogerror("usage: pvmd3 [-ddebugmask] [-nhostname] [hostfile]\n");
 5330                 pvmbailout(0);
 5331         }
 5332         if (argc == 2) {
 5333                 filehosts = readhostfile(argv[1]);
 5334         }
 5335         else if (s = getenv("PVMHOSTFILE")) {
 5336                 filehosts = readhostfile(s);
 5337         }
 5338         if (pvmdebmask & PDMSTARTUP) {
 5339                 if (filehosts) {
 5340                         pvmlogerror("master_config() host file:\n");
 5341                         ht_dump(filehosts);
 5342  
 5343                 } else 
 5344                         pvmlogerror("master_config() null host file\n");
 5345         }
 5346  
 5347         hosts = ht_new(1);
 5348         hosts->ht_serial = 1;
 5349         hosts->ht_master = 1;
 5350         hosts->ht_cons = 1;
 5351         hosts->ht_local = 1;
 5352  
 5353         hp = hd_new(1);
 5354         hp->hd_name = STRALLOC(hn);   /* Null Pointer Dereference (ID: 2687.2738) */
 5355         hp->hd_arch = STRALLOC(myarchname);   /* Null Pointer Dereference (ID: 2685.2737) */
 5356         hp->hd_mtu = pvmudpmtu;
 5357         hp->hd_dsig = pvmmydsig;
 5358         ht_insert(hosts, hp);
 5359         hd_unref(hp);
 5360  
 5361         hp = hd_new(0);
 5362         hp->hd_name = STRALLOC("pvmd'");   /* Null Pointer Dereference (ID: 2686.2736) */
 5363         hp->hd_arch = STRALLOC(myarchname);   /* Null Pointer Dereference (ID: 2685.2734) */
 5364         hp->hd_mtu = pvmudpmtu;
 5365         hp->hd_dsig = pvmmydsig;
 5366         ht_insert(hosts, hp);
 5367         hd_unref(hp);
 5368  
 5369         /*
 5370         * get attributes from host file if available 
 5371         */ 
 5372  
 5373         hp = hosts->ht_hosts[1];
 5374         if (filehosts &&
 5375                         ((hp2 = nametohost(filehosts, hp->hd_name)) 
 5376                         || (hp2 = filehosts->ht_hosts[0]))) {
 5377                 applydefaults(hp, hp2);
 5378         }
 5379  
 5380         if (!hp->hd_epath) {
 5381                 if ((s = getenv("PVM_PATH")))
 5382                         hp->hd_epath = STRALLOC(s);   /* Null Pointer Dereference (ID: 2683.2732) */
 5383                 else 
 5384                         hp->hd_epath = STRALLOC(DEFBINDIR);   /* Null Pointer Dereference (ID: 2682.2731) */
 5385         }
 5386         epaths = colonsep(varsub(hp->hd_epath));
 5387         if (!hp->hd_bpath)
 5388                 hp->hd_bpath = STRALLOC(DEFDEBUGGER);   /* Null Pointer Dereference (ID: 2680.2729) */
 5389         debugger = varsub(hp->hd_bpath);
 5390         if (!hp->hd_wdir) {
 5391                 if ((s = getenv("PVM_WD")))
 5392                         hp->hd_wdir = STRALLOC(s);   /* Null Pointer Dereference (ID: 2679.2728) */
 5393                 else 
true5394                         hp->hd_wdir = STRALLOC(pvmgethome());   /* Null Pointer Dereference (ID: 2678.2727) */
 5395         }
bytes_after(hp->hd_wdir) < 35396         s = varsub(hp->hd_wdir);
     Enter master_config / varsub
 5205   char * 
bytes_after($param_1) < 35206   varsub(s) 
 5207           char *s;
 5208   {
 5209           int rm = 8;             /* length of result string space */ 
 5210           char *r;                /* result string */ 
 5211           int rl = 0;
 5212           char *p;
 5213           char *vn, *vv;
 5214           char c;
 5215           int l;
 5216    
 5217           r = TALLOC(rm, char, "var");
 5218           while (*s) {   /* Null Pointer Dereference (ID: 2556.2587) */
bytes_after(s) < 35219                   for (p = s; *p && *p != '$'; p++) ;
 5220                   if (l = p - s) {
 5221                           if (rl + l >= rm) {
 5222                                   rm = rl + l + 1;
 5223                                   r = TREALLOC(r, rm, char);
 5224                           }
 5225                           strncpy(r + rl, s, l);   /* Null Pointer Dereference (ID: 2549.2580) */
 5226                           rl += l;
 5227                   }
bytes_after(p) < 35228                   s = p++;
 5229                   if (*s == '$') {
 5230                           if (*p == '{')
bytes_after(p) < 25231                                   p++;
 5232                           vn = p;
bytes_after(p) < 15233                           while (isalnum(*p) || *p == '_')     /* Buffer Overrun */  /* Negative Character Value (ID: 2418.2435) */
     Exit master_config / varsub
Preconditions
$param_2 = 2
((char*)&$unknown_853179)[4] >= 1
strlen(&$unknown_853184) != 1
strlen(&$unknown_853184) > 0
((char*)&$heap_119820)[8] >= -1
((char*)&$heap_119828)[144] >= 0
((char*)&$heap_119828)[32] = 0
$heap_119839 = 36
((char*)&$heap_119839)[1] = 123
$input_12 >= 1
$input_60 != 0
Postconditions
((char*)&$unknown_853180)[184]' = &$heap_119834
((char*)&$unknown_853180)[40]' = &$heap_119836
((char*)&$unknown_853180)[48]' = &$heap_119838
((char*)&$unknown_853180)[56]' = &$heap_119839
argc' = $param_2
argv' = $param_3
atnewline' = 1
debugger' = &$unknown_853183
epaths' = &$heap_119837
filehosts' = &$unknown_853179
hd' = &#string17[0]
$heap_119820' = 1
bytes_after(&$heap_119820)' = 40
$heap_119820' is allocated by malloc
$heap_119820' is allocated
bytes_before(&$heap_119820)' = 0
strlen(&$heap_119820)' = 0
((char*)&$heap_119820)[16]' = 1
((char*)&$heap_119820)[20]' = 1
((char*)&$heap_119820)[8]' = ((char*)&$heap_119820)[8] + 1
((char*)&$heap_119820)[12]' = 1
$heap_119822' = 1
bytes_after(&$heap_119822)' = 200
$heap_119822' is allocated by malloc
bytes_before(&$heap_119822)' = 0
strlen(&$heap_119822)' = 0
((char*)&$heap_119822)[136]' = &$heap_119823
((char*)&$heap_119822)[152]' = 1
((char*)&$heap_119822)[16]' = &$heap_119827
((char*)&$heap_119822)[168]' = 1000
((char*)&$heap_119822)[176]' = 0
((char*)&$heap_119822)[76]' = pvmmydsig
((char*)&$heap_119822)[8]' = &$heap_119826
((char*)&$heap_119822)[84]' = pvmudpmtu
((char*)&$heap_119822)[88]' = 2
((char*)&$heap_119822)[104]' = 1
((char*)&$heap_119822)[108]' = 1
((char*)&$heap_119822)[112]' = &$heap_119825
((char*)&$heap_119822)[120]' = &$heap_119824
bytes_after(&$heap_119823)' = 184
$heap_119823' is allocated by malloc
$heap_119823' is allocated
bytes_before(&$heap_119823)' = 0
((char*)&$heap_119823)[16]' = 0
((char*)&$heap_119823)[176]' = 0
((char*)&$heap_119823)[24]' = 0
((char*)&$heap_119823)[32]' = 0
((char*)&$heap_119823)[40]' = 0
bytes_after(&$heap_119824)' = 184
$heap_119824' is allocated by malloc
$heap_119824' is allocated
bytes_before(&$heap_119824)' = 0
((char*)&$heap_119824)[16]' = 0
((char*)&$heap_119824)[176]' = 0
((char*)&$heap_119824)[24]' = 0
((char*)&$heap_119824)[32]' = 0
((char*)&$heap_119824)[40]' = 0
bytes_after(&$heap_119825)' = 184
$heap_119825' is allocated by malloc
$heap_119825' is allocated
bytes_before(&$heap_119825)' = 0
((char*)&$heap_119825)[16]' = 0
((char*)&$heap_119825)[176]' = 0
((char*)&$heap_119825)[24]' = 0
((char*)&$heap_119825)[32]' = 0
((char*)&$heap_119825)[40]' = 0
$heap_119826' = *$param_1
bytes_after(&$heap_119826)' = strlen($param_1) + 1
$heap_119826' is allocated by malloc
$heap_119826' is allocated
bytes_before(&$heap_119826)' = 0
strlen(&$heap_119826)' = strlen($param_1)
$heap_119827' = *myarchname
bytes_after(&$heap_119827)' = strlen(myarchname) + 1
$heap_119827' is allocated by malloc
$heap_119827' is allocated
bytes_before(&$heap_119827)' = 0
strlen(&$heap_119827)' = strlen(myarchname)
$heap_119828' = 0
bytes_after(&$heap_119828)' = 200
$heap_119828' is allocated by malloc
$heap_119828' is freed
bytes_before(&$heap_119828)' = 0
strlen(&$heap_119828)' = 0
((char*)&$heap_119828)[136]' = &$heap_119831
((char*)&$heap_119828)[152]' = 1
((char*)&$heap_119828)[16]' = &$heap_119833
((char*)&$heap_119828)[168]' = 1000
((char*)&$heap_119828)[176]' = 0
((char*)&$heap_119828)[76]' = pvmmydsig
((char*)&$heap_119828)[8]' = &$heap_119832
((char*)&$heap_119828)[84]' = pvmudpmtu
((char*)&$heap_119828)[88]' = 2
((char*)&$heap_119828)[104]' = 1
((char*)&$heap_119828)[108]' = 1
((char*)&$heap_119828)[112]' = &$heap_119830
((char*)&$heap_119828)[120]' = &$heap_119829
bytes_after(&$heap_119829)' = 184
$heap_119829' is allocated by malloc
bytes_before(&$heap_119829)' = 0
((char*)&$heap_119829)[176]' = 0
((char*)&$heap_119829)[32]' = 0
((char*)&$heap_119829)[40]' = 0
bytes_after(&$heap_119830)' = 184
$heap_119830' is allocated by malloc
bytes_before(&$heap_119830)' = 0
((char*)&$heap_119830)[16]' = 0
((char*)&$heap_119830)[176]' = 0
((char*)&$heap_119830)[24]' = 0
((char*)&$heap_119830)[32]' = 0
((char*)&$heap_119830)[40]' = 0
$heap_119831' = &$heap_119831
bytes_after(&$heap_119831)' = 184
$heap_119831' is allocated by malloc
bytes_before(&$heap_119831)' = 0
((char*)&$heap_119831)[176]' = 0
((char*)&$heap_119831)[32]' = 0
((char*)&$heap_119831)[40]' = 0
((char*)&$heap_119831)[8]' = &$heap_119831
$heap_119832' = 112
bytes_after(&$heap_119832)' = 6
$heap_119832' is allocated by malloc
bytes_before(&$heap_119832)' = 0
strlen(&$heap_119832)' = 5
$heap_119833' = *myarchname
bytes_after(&$heap_119833)' = strlen(myarchname) + 1
$heap_119833' is allocated by malloc
bytes_before(&$heap_119833)' = 0
strlen(&$heap_119833)' = strlen(myarchname)
bytes_after(&$heap_119834)' = strlen(((char*)&$unknown_853181)[184]) + 1
$heap_119834' is allocated by malloc
$heap_119834' is allocated
bytes_before(&$heap_119834)' = 0
strlen(&$heap_119834)' = strlen(((char*)&$unknown_853181)[184])
$heap_119835' = $input_60
bytes_after(&$heap_119835)' = $input_12 + 1
$heap_119835' is allocated by malloc
$heap_119835' is a non-heap object
bytes_before(&$heap_119835)' = 0
strlen(&$heap_119835)' = $input_12
$heap_119836' = $input_60
bytes_after(&$heap_119836)' = $input_12 + 1
$heap_119836' is allocated by malloc
$heap_119836' is allocated
bytes_before(&$heap_119836)' = 0
$heap_119837' = &$unknown_853182
$heap_119837' is allocated by malloc
$heap_119837' is allocated
bytes_before(&$heap_119837)' = 0
((char*)&$heap_119837)[8]' = 0
$heap_119838' = 36
bytes_after(&$heap_119838)' = 23
$heap_119838' is allocated by malloc
$heap_119838' is allocated
bytes_before(&$heap_119838)' = 0
bytes_after(&$heap_119839)' = 2
$heap_119839' is allocated by malloc
$heap_119839' is allocated
bytes_before(&$heap_119839)' = 0
strlen(&$heap_119839)' = strlen(&$unknown_853184)
bytes_after(&$heap_119840)' = 8
$heap_119840' is allocated by malloc
$heap_119840' is allocated
bytes_before(&$heap_119840)' = 0
hn' = $param_1
hosts' = &$heap_119820
hp' = &$unknown_853180
hp2' = &$unknown_853181
l' = 0
p' = &$heap_119839 + 2
r' = &$heap_119840
rl' = 0
rm' = 8
s' = &$heap_119839
s' = 0
vn' = &$heap_119839 + 2




Change Warning 2677.2726 : Buffer Overrun

Priority:
State:
Finding:
Owner:
Note: