Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at host.c:806

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2460.2488
Similar Warnings: 2460.2994
Procedure: parsehost
Trace: View
Modified: Wed Sep 2 12:52:39 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/host.c
   Enter parsehost
 726 parsehost(buf, hp) 
 727         char *buf;
 728         struct hostd *hp;
 729 {
 730         char *av[10];           /* parsed words */ 
 731         int ac;
 732         int err = 0;
 733  
 734         ac = sizeof(av)/sizeof(av[0]);
 735         if (acav(buf, &ac, av)) {
 736                 pvmlogprintf("parsehost(): line too long\n");
 737                 goto bad;
 738         }
 739         if (!ac)
 740                 goto bad;
 741  
 742         /* add options to host descriptor */ 
 743  
 744         while (--ac > 0) {
 745                 if (!strncmp(av[ac], "lo=", 3)) {
 746                         if (hp->)
 747                                 PVM_FREE(hp->);
 748                         hp-> = STRALLOC(av[ac] + 3);   /* Null Pointer Dereference (ID: 2459.2487) */
 749                         continue;
 750                 }
 751                 if (!strncmp(av[ac], "dx=", 3)) {
 752                         if (hp->hd_dpath)
 753                                 PVM_FREE(hp->hd_dpath);
 754                         hp->hd_dpath = STRALLOC(av[ac] + 3);   /* Null Pointer Dereference (ID: 2458.2486) */
 755                         continue;
 756                 }
 757                 if (!strncmp(av[ac], "ep=", 3)) {
 758                         if (hp->hd_epath)
 759                                 PVM_FREE(hp->hd_epath);
 760                         hp->hd_epath = STRALLOC(av[ac] + 3);   /* Null Pointer Dereference (ID: 2457.2485) */
 761                         continue;
 762                 }
 763                 if (!strncmp(av[ac], "sp=", 3)) {
 764                         hp->hd_speed = atoi(av[ac] + 3);
 765                         hp->hd_flag |= HF_SPEED;
 766                         continue;
 767                 }
 768                 if (!strncmp(av[ac], "bx=", 3)) {
 769                         if (hp->hd_bpath)
 770                                 PVM_FREE(hp->hd_bpath);
 771                         hp->hd_bpath = STRALLOC(av[ac] + 3);   /* Null Pointer Dereference (ID: 2456.2484) */
 772                         continue;
 773                 }
 774                 if (!strncmp(av[ac], "wd=", 3)) {
 775                         if (hp->hd_wdir)
 776                                 PVM_FREE(hp->hd_wdir);
 777                         hp->hd_wdir = STRALLOC(av[ac] + 3);   /* Null Pointer Dereference (ID: 2455.2483) */
 778                         continue;
 779                 }
 780                 if (!strncmp(av[ac], "so=", 3)) {
 781                         if (hp->hd_sopts)
 782                                 PVM_FREE(hp->hd_sopts);
 783                         hp->hd_sopts = STRALLOC(av[ac] + 3);   /* Null Pointer Dereference (ID: 2454.2482) */
 784                         continue;
 785                 }
 786                 if (!strncmp(av[ac], "ip=", 3)) {
 787                         if (hp->hd_aname)
 788                                 PVM_FREE(hp->hd_aname);
 789                         hp->hd_aname = STRALLOC(av[ac] + 3);   /* Null Pointer Dereference (ID: 2453.2481) */
 790                         continue;
 791                 }
 792                 if (!strncmp(av[ac], "id=", 3)) {
 793                         if (hp->hd_vmid)
 794                                 PVM_FREE(hp->hd_vmid);
 795                         hp->hd_vmid = STRALLOC(av[ac] + 3);   /* Null Pointer Dereference (ID: 2452.2480) */
 796                         continue;
 797                 }
 798                 pvmlogprintf("parsehost(): unknown option \"%s\"\n", av[ac]);
 799                 err++;
 800         }
 801         if (err)
 802                 goto bad;
 803  
 804         if (hp->hd_name)   /* Null Pointer Dereference (ID: 2520.2551) */  /* Null Pointer Dereference (ID: 2613.2647) */
 805                 PVM_FREE(hp->hd_name);
true806         hp->hd_name = STRALLOC(av[0]);     /* Null Pointer Dereference */
Preconditions
&$unknown_86244 = 0
((char*)$param_2)[8] != 0
*$param_1 != 0
strlen($param_1) != 0
Postconditions
ac' = 0
av[0]' = &$unknown_86243
buf' = $param_1
err' = 0
hp' = $param_2




Change Warning 2460.2488 : Null Pointer Dereference

Because they are very similar, this warning shares annotations with warning 2460.2994.

Priority:
State:
Finding:
Owner:
Note: