Subj : New Defects reported by Coverity Scan for Synchronet To : cov-scan@synchro.net From : scan-admin@coverity.com Date : Wed Sep 06 2023 12:42 pm Hi, Please find the latest report on new defect(s) introduced to Synchronet found with Coverity Scan. 2 new defect(s) introduced to Synchronet found with Coverity Scan. 2 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan. New defect(s) Reported-by: Coverity Scan Showing 2 of 2 defect(s) ** CID 465170: Resource leaks (RESOURCE_LEAK) /scfg/scfg.c: 2447 in new_item() ________________________________________________________________________________________________________ *** CID 465170: Resource leaks (RESOURCE_LEAK) /scfg/scfg.c: 2447 in new_item() 2441 void** p; 2442 void* item; 2443 2444 if((item = calloc(size, 1)) == NULL) 2445 return NULL; 2446 if((p = realloc(list, size * ((*total) + 1))) == NULL) >>> CID 465170: Resource leaks (RESOURCE_LEAK) >>> Variable "item" going out of scope leaks the storage it points to. 2447 return NULL; 2448 list = p; 2449 for(int i = *total; i > index; --i) 2450 list[i] = list[i - 1]; 2451 list[index] = item; 2452 ++(*total); ** CID 465169: (SIZEOF_MISMATCH) /scfg/scfgxfr1.c: 544 in xfer_opts() /scfg/scfgxfr1.c: 698 in xfer_opts() /scfg/scfgxfr1.c: 1124 in xfer_opts() /scfg/scfgxfr1.c: 844 in xfer_opts() /scfg/scfgxfr1.c: 412 in xfer_opts() /scfg/scfgxfr1.c: 982 in xfer_opts() ________________________________________________________________________________________________________ *** CID 465169: (SIZEOF_MISMATCH) /scfg/scfgxfr1.c: 544 in xfer_opts() 538 } 539 if(msk == MSK_COPY) { 540 savftest=*cfg.ftest[i]; 541 continue; 542 } 543 if(msk == MSK_PASTE) { >>> CID 465169: (SIZEOF_MISMATCH) >>> Passing argument "240UL /* sizeof (ftest_t) */" to function "new_item" and then casting the return value to "ftest_t **" is suspicious. 544 if((cfg.ftest = (ftest_t**)new_item(cfg.ftest, sizeof(ftest_t), i, &cfg.total_ftests)) == NULL) { 545 errormsg(WHERE, ERR_ALLOC, "ftests", sizeof(ftest_t) * (cfg.total_ftests + 1)); 546 cfg.total_ftests = 0; 547 bail(1); 548 } 549 *cfg.ftest[i]=savftest; /scfg/scfgxfr1.c: 698 in xfer_opts() 692 } 693 if(msk == MSK_COPY) { 694 savdlevent=*cfg.dlevent[i]; 695 continue; 696 } 697 if(msk == MSK_PASTE) { >>> CID 465169: (SIZEOF_MISMATCH) >>> Passing argument "240UL /* sizeof (dlevent_t) */" to function "new_item" and then casting the return value to "dlevent_t **" is suspicious. 698 if((cfg.dlevent = (dlevent_t**)new_item(cfg.dlevent, sizeof(dlevent_t), i, &cfg.total_dlevents)) == NULL) { 699 errormsg(WHERE, ERR_ALLOC, "dlevents", sizeof(dlevent_t) * (cfg.total_dlevents + 1)); 700 cfg.total_dlevents = 0; 701 bail(1); 702 } 703 *cfg.dlevent[i]=savdlevent; /scfg/scfgxfr1.c: 1124 in xfer_opts() 1118 } 1119 if(msk == MSK_COPY) { 1120 savprot=*cfg.prot[i]; 1121 continue; 1122 } 1123 if(msk == MSK_PASTE) { >>> CID 465169: (SIZEOF_MISMATCH) >>> Passing argument "720UL /* sizeof (prot_t) */" to function "new_item" and then casting the return value to "prot_t **" is suspicious. 1124 if((cfg.prot = (prot_t**)new_item(cfg.prot, sizeof(prot_t), i, &cfg.total_prots)) == NULL) { 1125 errormsg(WHERE, ERR_ALLOC, "prots", sizeof(prot_t) * (cfg.total_prots + 1)); 1126 cfg.total_prots=0; 1127 bail(1); 1128 } 1129 *cfg.prot[i]=savprot; /scfg/scfgxfr1.c: 844 in xfer_opts() 838 } 839 if(msk == MSK_COPY) { 840 savfextr=*cfg.fextr[i]; 841 continue; 842 } 843 if(msk == MSK_PASTE) { >>> CID 465169: (SIZEOF_MISMATCH) >>> Passing argument "199UL /* sizeof (fextr_t) */" to function "new_item" and then casting the return value to "fextr_t **" is suspicious. 844 if((cfg.fextr = (fextr_t**)new_item(cfg.fextr, sizeof(fextr_t), i, &cfg.total_fextrs)) == NULL) { 845 errormsg(WHERE, ERR_ALLOC, "fextrs", sizeof(fextr_t) * (cfg.total_fextrs + 1)); 846 cfg.total_fextrs = 0; 847 bail(1); 848 } 849 *cfg.fextr[i]=savfextr; /scfg/scfgxfr1.c: 412 in xfer_opts() 406 } 407 if(msk == MSK_COPY) { 408 savfview=*cfg.fview[i]; 409 continue; 410 } 411 if(msk == MSK_PASTE) { >>> CID 465169: (SIZEOF_MISMATCH) >>> Passing argument "199UL /* sizeof (fview_t) */" to function "new_item" and then casting the return value to "fview_t **" is suspicious. 412 if((cfg.fview = (fview_t**)new_item(cfg.fview, sizeof(fview_t), i, &cfg.total_fviews)) == NULL) { 413 errormsg(WHERE, ERR_ALLOC, "fviews", sizeof(fview_t) * (cfg.total_fviews + 1)); 414 cfg.total_fviews = 0; 415 bail(1); 416 } 417 *cfg.fview[i]=savfview; /scfg/scfgxfr1.c: 982 in xfer_opts() 976 } 977 if(msk == MSK_COPY) { 978 savfcomp=*cfg.fcomp[i]; 979 continue; 980 } 981 if(msk == MSK_PASTE) { >>> CID 465169: (SIZEOF_MISMATCH) >>> Passing argument "199UL /* sizeof (fcomp_t) */" to function "new_item" and then casting the return value to "fcomp_t **" is suspicious. 982 if((cfg.fcomp = (fcomp_t**)new_item(cfg.fcomp, sizeof(fcomp_t), i, &cfg.total_fcomps)) == NULL) { 983 errormsg(WHERE, ERR_ALLOC, "fcomps", sizeof(fcomp_t) * (cfg.total_fcomps + 1)); 984 cfg.total_fcomps = 0; 985 bail(1); 986 } 987 *cfg.fcomp[i]=savfcomp; ________________________________________________________________________________________________________ To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yp-2FP9gGRhvFklLaQKuBylUrkMFB3WMR2p7qIYKYTZrh4BbWTBf-2B-2Fi5ZUVF-2Fo-2B6flxo-3D5wZ8_g4j7BHlu96plUOfCQsO0yRjoWZCZl8YGnZ-2FUtT39hrCnsQIL3fFmuqL7faauDZIkRsjaF7SdWuX9-2F6F0cLhQPK2eigoJW5CI-2BTBbzcwuB-2Fnb9gU96N518jXtyrLldNWW25I5ASjWizI9KxhCsvWXL8lcGsg-2BB04X9jrEFEkrP4hbjq1CPbLr3dEPsMh2-2BJD6OG7PFXOCZ8vIf02fm0mzeA-3D-3D .