Blame SOURCES/sblim-wbemcli-1.6.3-covscan-fixes.patch

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