Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Null Pointer Dereference  at host.c:777

Categories: LANG.MEM.NPD CWE:476
Warning ID: 46.28631
Similar Warnings: 46.29287
Procedure: parsehost
Trace: view
Modified: Thu Nov 26 11:36:48 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/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: 50.28635) */
 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: 49.28634) */
 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: 48.28633) */
 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: 47.28632) */
 772                         continue;
 773                 }
 774                 if (!strncmp(av[ac], "wd=", 3)) {
 775                         if (hp->hd_wdir)
 776                                 PVM_FREE(hp->hd_wdir);
true777                         hp->hd_wdir = STRALLOC(av[ac] + 3);     /* Null Pointer Dereference */
 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: 45.28630) */
 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: 44.28629) */
 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: 43.28628) */
 796                         continue;
 797                 }
 798                 pvmlogprintf("parsehost(): unknown option \"%s\"\n", av[ac]);
 799                 err++;
Preconditions
&$unknown_64909 != 0
*buf != 0
strlen(buf) != 0
strlen(av[1]) = 3
Postconditions
ac' = 1
$unknown_64909' is freed
codesonar_distance_tweak' = 2
errno' != 0




Change Warning 46.28631 : Null Pointer Dereference

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

Priority:
State:
Finding:
Owner:
Note: