sblim-wbemcli/sblim-wbemcli-1.6.3-covscan...

98 lines
3.2 KiB
Diff

diff -up sblim-wbemcli-1.6.3/CimCurl.cpp.orig sblim-wbemcli-1.6.3/CimCurl.cpp
--- sblim-wbemcli-1.6.3/CimCurl.cpp.orig 2019-08-27 14:18:53.329846123 +0200
+++ sblim-wbemcli-1.6.3/CimCurl.cpp 2019-08-27 14:18:53.332846130 +0200
@@ -369,6 +369,7 @@ void CimomCurl::setClientCertificates(co
} else if (cacert) {
FILE *fp;
if ((fp = fopen(cacert, "r"))) {
+ fclose(fp);
if ((rv=curl_easy_setopt(mHandle,CURLOPT_SSL_VERIFYPEER,1))) {
cerr << getErrorMessage(rv) << endl;
throw HttpException("Could not enable peer verification.");
@@ -377,7 +378,6 @@ void CimomCurl::setClientCertificates(co
cerr << getErrorMessage(rv) << endl;
throw HttpException("Could not load CA certificate.");
}
- fclose(fp);
} else {
throw HttpException(
string("Could not open CA certificate file: ") + string(cacert)
diff -up sblim-wbemcli-1.6.3/CimXml.cpp.orig sblim-wbemcli-1.6.3/CimXml.cpp
--- sblim-wbemcli-1.6.3/CimXml.cpp.orig 2014-10-13 18:05:30.000000000 +0200
+++ sblim-wbemcli-1.6.3/CimXml.cpp 2019-08-27 14:32:20.068589450 +0200
@@ -159,7 +159,7 @@ int XmlBuffer::skipElement(const char *t
cerr<<"--- XmlBuffer::skipElement(\""<<t<<"\")"<<endl;
#endif
char eTag[256]="</";
- strcat(eTag,t);
+ strncat(eTag,t,252);
strcat(eTag,">");
char *e=strstr(cur,eTag);
if (e) {
@@ -451,7 +451,7 @@ AVPs::AVPs(char *s, PropertyArray &prop)
AVPs::AVPs(char *s, ParameterArray &param)
{
- char *n, *t, *u, *v, *w;
+ char *n, *t, *u, *v;
int i,k,j,l;
bool name = false;
bool addAValue = false;
@@ -856,8 +856,6 @@ IMethodresponseXml::IMethodresponseXml(X
if (irv->getReturnData() == NULL) {
/* OpenWBEM support */
throw NoReturnValue();
- delete irv;
- irv=NULL;
}
if (xb.endTag("IMETHODRESPONSE")) return;
else throw ParseException("Expecting </IMETHODRESPONSE> tag(2)");
@@ -877,8 +875,6 @@ IMethodresponseXml::IMethodresponseXml(X
}
*/ else if (xb.endTag("IMETHODRESPONSE")) {
throw NoReturnValue();
- irv=NULL;
- return;
}
/* else throw ParseException("Expecting </IMETHODRESPONSE> tag(1)");
}
@@ -934,8 +930,6 @@ MethodresponseXml::MethodresponseXml(Xml
}
*/ else if (xb.endTag("METHODRESPONSE")) {
throw NoReturnValue();
- rvl=NULL;
- return;
}
/* else throw ParseException("Expecting </METHODRESPONSE> tag(1)");
}
@@ -2950,7 +2944,7 @@ char *strndup(char *f, int n) {
URL::URL(const char *U)
{
- int pint,indir=0;
+ int indir=0;
char *p,*q,*phelp,*np,*last,*un,*b,*h,*z;
char *origu, *u;
u = origu = strdup(U);
@@ -3061,7 +3055,7 @@ URL::URL(const char *U)
zone_id = -1;
}
- pint=strtol(port.c_str(),&np,10);
+ (void) strtol(port.c_str(),&np,10);
if (*np) throw URLException("Invalid port number");
if (!phelp || strlen(phelp+1) == 0) {
@@ -3168,9 +3162,11 @@ int URL::getNetDeviceNum(string devName)
while (2 == fscanf(fp, scnfmt.c_str(), &dev_num, dev_name)) {
if (strcmp(devName.c_str(), dev_name) == 0) { /* match */
+ fclose(fp);
return dev_num;
}
}
+ fclose(fp);
return -1; // zone id not found in interfaces table
#endif
}